Help casting void pointer to GtkWidget



Hi Everyone

I am doing something strange. I am mixing C GTK and COBOL. It's GnuCOBOL and it compiles to intermediate C.

I can create widgets by creating pointers in COBOL and passing them to C GTK functions and such but I can't seem to connect signals.

This code:

int sig_con1( GtkWidget * widget_id ) {
g_signal_connect(G_OBJECT(widget_id),"clicked", G_CALLBACK(handler1_to_handler2),NULL);
.....


compiles but when it runs I get :

(anak:18978): GLib-GObject-WARNING **: invalid unclassed pointer in cast to 'GObject'

(anak:18978): GLib-GObject-WARNING **: instance with invalid (NULL) class pointer


COBOL is actually passing in a void pointer so widget_id is actually type void. I can't seem to cast it to a pointer to a G_OBJECT. Changing the functions prototype to void * widget_id did not help.

Could anyone give me a tip or two of how to cast ?

Thanks-Patrick








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]