On 14 May 2010, at 22:05, Noah Lavine wrote:
How would this work if I wanted to not run Guile embedded in a C++ program, but instead load the C++ code at runtime from a regular Guile interpreter? (This could use either the libffi binding or the regular Guile ones.)
Since Guile is written in C, formally according to the C++ standard, you can only load Guile from C++ code, and not the opposite. So main() must be C++.
GCC though has integrated C and C++ fully, it seems. So you can call C+ + from C code, but the latter do not implement C++ exception stacks, and may not call C++ initialization function properly (I haven't checked). It means that throwing and catching exceptions within C++ functions called from C seems to work fine, but if one tries to pass it through a C function, the program will throw a terminate exception.
Hans