I'm a Scheme programmer, and I'm attempting to use Guile to call Scheme functions from C++ code within a Bison specification. The documentation concerning Guile and C is great; however, I haven't found much relevant, up-to-date information about Guile and C++. Because every C program is technically a C++ program, calling Scheme functions from C++ via Guile should be easy enough. Alas, I'm not a C/C++ programmer, so I was hoping some of the C++ gurus on here could help me out. Here is some of my code:
My wrapper functions for the Scheme code are in symtable.c. Using these same functions from pure C works just fine. Calling them from C++ generates the following compiler error:Code:%{ #include <fstream> #include <iomanip> #include <string> using namespace std; #include "List.h" #include "paslex.h" #include "paspar.h" extern "C" { #include <libguile.h> #include "symtable.h" } void yyerror(char* m); extern ofstream tfs; extern int line; extern int col; extern "C" { // Create namespace stack and lexical level 0 with built-in types. SCM namespace_stack; SCM namespace0; SCM real_type; SCM real_type_sym; SCM integer_type; SCM integer_type_sym; // errors begin here namespace_stack = make_name_stack(); namespace0 = make_namespace(); real_type = make_type_attr(64, 64); real_type_sym = make_type_sym("real", real_type); integer_type = make_type_attr(32, 32); integer_type_sym = make_type_sym("integer", integer_type); insert_symbol(real_type_sym, namespace0); insert_symbol(integer_type_sym, namespace0); push(namespace0, namespace_stack); } %}
...and a similar error for lines 34 through 42. I'm using GCC 4.4.5 and Guile 1.6.8 on Ubuntu 10.10. I'm sure this is a newbie mistake, but help with this problem would be greatly appreciated. Let me know if more information is needed.paspar.y:33: error: expected constructor, destructor, or type conversion before ‘=’ token



LinkBack URL
About LinkBacks


