On 10/29/05, Pupeno <[EMAIL PROTECTED]> wrote: > Hello, I have a file named glib.c that contains: > (declare (unit glib)) > #> > #include <glib.h> > <# > (define-foreign-type gpointer "gpointer") > > I compile that to a .c and then to a .o. > I have another file that uses gpointer, I first tried > (declare (uses glib)) > but it didn't work: > chicken gtkhello.scm -output-file gtkhello.c > compiling `gtkhello.scm' ... > generating `gtkhello.c' ... > Error: illegal foreign type `gpointer' > > So I changed it to (include "glib") and I still get the same error. What am I > missing ?
Foreign-type declarations are only visible in the currently compiled file, and thus must be included. To do anything useful with a value, chicken must know it's fundamental type. In the case above, gpointer is opaque to chicken: it could be a structure, or a primitive type, or whatever. In this case, you want it to be treated like a pointer, and you must tell the compiler about it. One solution would be: (define-foreign-type gpointer (pointer void)) cheers, felix _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
