Guile Mailing List Archive

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

Is it OK to pass an SCM through (void *)?




In gnucash, I need to attach some SCM values (Guile level function
pointers) as the data to GTK callback functions.  So is it OK to do
this:

    SCM setter_func;
    ...
    gtk_signal_connect (GTK_OBJECT (option_toggle), 
                        "toggled",
                        (GtkSignalFunc) call_boolean_setter,
                        (gpointer) setter_func);

or do I need to do something safer like this:

    SCM setter_func;
    SCM *setter_func_ptr = malloc(sizeof(SCM));
    *setter_func_ptr = setter_func;
    ...
    gtk_signal_connect (GTK_OBJECT (option_toggle), 
                        "toggled",
                        (GtkSignalFunc) call_boolean_setter,
                        (gpointer) setter_func_ptr);

Thanks

-- 
Rob Browning <rlb@cs.utexas.edu> PGP=E80E0D04F521A094 532B97F5D64E3930

Guile Home | Main Index | Thread Index