Is the C interface supposed to work with C++? When I try to compile the same example (which john provided) with the -c++ option, the compiler borks on the line
C_word k = CHICKEN_run(C_toplevel); with the error [EMAIL PROTECTED] scheme]$ csc x2.scm y2.c -embedded -c++ y2.c: In function `int main()': y2.c:5: error: invalid conversion from `void (*)(int, int, int)' to `void*' y2.c:5: error: initializing argument 1 of `int CHICKEN_run(void*)' *** Shell command terminated with exit status 1: g++ y2.c -o y2.o -c -DHAVE_CHICKEN_CONFIG_H -Os -fomit-frame-pointer -fno-strict-aliasing -Wall -Wno-unused -Wno-uninitialized -DC_ENABLE_PTABLES -DC_NO_PIC_NO_DLL -DC_EMBEDDED -I /home/elliot/usr/include When I cast C_toplevel to a (void *), the error is ------------------------------------------------ [EMAIL PROTECTED] scheme]$ csc x2.scm y2.c -embedded -c++ y2.o(.text+0x30): In function `main': : undefined reference to `foo(char*)' collect2: ld returned 1 exit status *** Shell command terminated with exit status 1: g++ y2.o x2.o -lchicken -o x2 -L/home/elliot/usr/lib -Wl,-R/home/elliot/usr/lib -ldl -lm -ldl -lchicken ------------------------------------------------ This leads me to think that some kind of name mangling in C++ prevents callbacks from having the correct name, or something. Is calling Scheme from C++ (as opposed to C) feasible, or should I have some sort of C glue layer? Thanks, Elliot _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
