Re: Phix+EuGTK
- Posted by irv Dec 13, 2020
- 2514 views
So far, not so good...
I get a seg fault, core dumped when I try to call a function contained in a library as a method.
Note that calling "gtk_window_new" to create a public "handle" to the new window works fine. Calling "gtk_widget_show" (or any other shared library routine) from within a class procedure fails.
Maybe there's something I am doing completely wrong.
constant LIB = open_dll("libgtk-3.so.0"), I = C_INT, -- INTEGER P = C_PTR, -- POINTER integer init = define_c_func(LIB,"gtk_init_check",{P,P},P) if init < 1 or c_func(init,{0,0})=0 then crash("Failed to initialize GTK library!") end if class Window public atom handle = c_func(define_c_func(LIB,"gtk_window_new",{I},P),{0}) procedure show() puts(1,"This handle: ") ? this.handle c_proc(define_c_proc(LIB,"gtk_widget_show",{P}),{this.handle}) -- seg fault -- define_c_proc is the part that fails when inside a procedure end procedure end class Window win = new() puts(1,"Win handle: ") ? win.handle win.show() main() procedure main() c_proc(define_c_proc(LIB,"gtk_main",{})) end procedure