On Mon, Aug 16, 2004 at 10:20:46AM +0200, Leopold Toetsch wrote:
> "gtk-signal-connect" or "g-signal-connect" isn't found here. I can't
> check the symbols of the lib, this dam** OS has symbols stripped. The
> other box has only gtk-1.2.
actually it should run as well against gtk-1.2 if "g_signal_connect"
is renamed "gtk_signal_connect". Attached here are the files with
that small change, but I've never been able to run any parrot code
against gtk v1.2 as parrot dies complaining:
/usr/lib/libgtk.so: undefined symbol: gdk_root_window
actually its simply dlopen dumping this.
(btw there parrot displays a misleading ".. No such file or dir.."
caused by the way loadlib lookups for the lib, note for a patch if
I find a nice way to clean it :)
> It returns a PerlUndef.
> Run it with -t.
Attached is the trace output.
> leo
Thanks,
Stephane
# -- Gtk Button Example.
.sub _gtkcallback
print "Hello\n"
.end
.sub main @MAIN
.include "gtk.pasm"
P0 = global "Gtk::gtk_init"
I5 = 0
invoke
P0 = global "Gtk::gtk_window_new"
null I5
invoke
P15 = P5
P0 = global "Gtk::gtk_button_new_with_label"
S5 = "Parrot"
invoke
# -- Save it.
P6 = P5
P11 = P5
# -- install callback?
newsub P6, .Sub, _gtkcallback
new P7, .Integer # -- just give it something even if dont care
set P7, 42
new_callback P5, P6, P7, "U"
P0 = global "Gtk::gtk_signal_connect"
S5 = "clicked"
P6 = P5
P5 = P11
invoke
# -- .
P5 = P11
P6 = P11
P0 = global "Gtk::gtk_widget_show"
invoke
# -- Set the container.
P5 = P15
P0 = global "Gtk::gtk_container_add"
invoke
P0 = global "Gtk::gtk_widget_show"
invoke
P0 = global "Gtk::gtk_main"
invoke
end
.end
saveall
loadlib P1, 'libgtk'
dlfunc P2, P1, 'gtk_init', 'vii'
store_global 'Gtk::gtk_init', P2
dlfunc P2, P1, 'gtk_main', 'vv'
store_global 'Gtk::gtk_main', P2
dlfunc P2, P1, 'gtk_widget_show', 'vp'
store_global 'Gtk::gtk_widget_show', P2
dlfunc P2, P1, 'gtk_container_add', 'vpp'
store_global 'Gtk::gtk_container_add', P2
dlfunc P2, P1, 'gtk_button_new_with_label', 'pt'
store_global 'Gtk::gtk_button_new_with_label', P2
dlfunc P2, P1, 'gtk_window_new', 'pi'
store_global 'Gtk::gtk_window_new', P2
dlfunc P2, P1, 'gtk_signal_connect', 'lptpP'
store_global 'Gtk::gtk_signal_connect', P2
restoreall
$ ./parrot -t gtk.toplevel.button.imc
8 saveall
9 loadlib P1, "libgtk-x11-2.0" - P1=NULL,
12 dlfunc P2, P1, "gtk_init", "vii" - P2=NULL,
P1=ParrotLibrary=PMC(0x8364108), ,
17 store_global "Gtk::gtk_init", P2 - , P2=NCI=PMC(0x8364048)
20 dlfunc P2, P1, "gtk_main", "vv" - P2=NCI=PMC(0x8364048),
P1=ParrotLibrary=PMC(0x8364108), ,
GC
25 store_global "Gtk::gtk_main", P2 - , P2=NCI=PMC(0x8364030)
28 dlfunc P2, P1, "gtk_widget_show", "vp" - P2=NCI=PMC(0x8364030),
P1=ParrotLibrary=PMC(0x8364108), ,
33 store_global "Gtk::gtk_widget_show", P2 - , P2=NCI=PMC(0x8364018)
36 dlfunc P2, P1, "gtk_container_add", "vpp" - P2=NCI=PMC(0x8364018),
P1=ParrotLibrary=PMC(0x8364108), ,
41 store_global "Gtk::gtk_container_a", P2 - , P2=NCI=PMC(0x8364000)
GC
44 dlfunc P2, P1, "gtk_button_new_with_", "pt" - P2=NCI=PMC(0x8364000),
P1=ParrotLibrary=PMC(0x8364108), ,
49 store_global "Gtk::gtk_button_new_", P2 - , P2=NCI=PMC(0x8363fe8)
52 dlfunc P2, P1, "gtk_window_new", "pi" - P2=NCI=PMC(0x8363fe8),
P1=ParrotLibrary=PMC(0x8364108), ,
57 store_global "Gtk::gtk_window_new", P2 - , P2=NCI=PMC(0x8363fd0)
GC
60 dlfunc P2, P1, "g_signal_connect", "lptpP" - P2=NCI=PMC(0x8363fd0),
P1=ParrotLibrary=PMC(0x8364108), ,
65 store_global "Gtk::g_signal_connec", P2 - , P2=PerlUndef=PMC(0x8363fb8
Num:0 Int:0)
68 restoreall
69 find_global P0, "Gtk::gtk_init" - P0=NULL,
72 set I5, 0 - I5=0,
75 invoke
76 find_global P0, "Gtk::gtk_window_new" - P0=NCI=PMC(0x8364048),
GC
79 null I5 - I5=0
81 invoke
82 set P15, P5 - P15=NULL, P5=UnManagedStruct=PMC(0x8363fa0)
85 find_global P0, "Gtk::gtk_button_new_" - P0=NCI=PMC(0x8363fd0),
88 set S5, "Parrot" - ,
91 invoke
92 set P6, P5 - P6=NULL, P5=UnManagedStruct=PMC(0x8363f88)
GC
95 set P11, P5 - P11=NULL, P5=UnManagedStruct=PMC(0x8363f88)
98 newsub P6, 22, -98 - P6=UnManagedStruct=PMC(0x8363f88), ,
102 new P7, 31 - P7=NULL,
105 set P7, 42 - P7=Integer=PMC(0x8363f58),
108 new_callback P5, P6, P7, "U" - P5=UnManagedStruct=PMC(0x8363f88),
P6=Sub=PMC(0x8363f70 Adr:0x84e6548), P7=Integer=PMC(0x8363f58),
GC
113 find_global P0, "Gtk::g_signal_connec" - P0=NCI=PMC(0x8363fe8),
116 set S5, "clicked" - S5="Parrot",
119 set P5, P11 - P5=UnManagedStruct=PMC(0x8363ef8),
P11=UnManagedStruct=PMC(0x8363f88)
122 invoke
get_string() not implemented in class 'UnManagedStruct'\n