guile-user
[Top][All Lists]
Advanced

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

Re: Guile and C++


From: Hans Aberg
Subject: Re: Guile and C++
Date: Fri, 14 May 2010 23:06:58 +0200

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]