Re: Phix+EuGTK
- Posted by irv Dec 15, 2020
- 2218 views
So far, so good. Now a class procedure which calls a shared lib function works. Here's what I'm testing with:
constant LIB = open_dll("libgtk-3.so.0") constant P = C_PTR, I = C_INT 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 showp() ? "show proc:" ? handle c_proc(define_c_proc(LIB,"gtk_widget_show",{P}),{handle}) end procedure function showf() ? "show func:" ? handle c_proc(define_c_proc(LIB,"gtk_widget_show",{P}),{handle}) return 1 end function end class procedure main() c_proc(define_c_proc(LIB,"gtk_main",{})) end procedure Window w1 = new() ? w1 ? w1.handle w1.showp() -- was seg fault, now works ? w1.showf() -- works main()
Calling either the showp procedure or the showf function displays the window.