> On 5 Jan 2015, at 17:27, Chris Vine <ch...@cvine.freeserve.co.uk> wrote: > > On Mon, 5 Jan 2015 15:44:16 +0100 > Hans Aberg <haber...@telia.com> wrote:
>> Guile is written entirely in C, so there is no problem. > > You referred to using C++ global objects with gc on Darwin, which is the > subject I am interested in. You did so presumably because GNU chess > is written in C++. Right. > I am interested in what the specific issue with C++ > is, because I have a project to which that may be relevant. C++ global objects have initializers which are run before main(), so if they do GC allocations, GC_INIT() can’t be put there. > According > to the OP, GNU chess is at present conventionally allocated, so none of > its static data (if any) is at present GC’ed. Right: no problem now without GC, and no problem if testing on GNU/Linux, but if it is a multiplatform distribution, it may show up. >>> In any event, I have not had problems getting guile to work as an >>> optional extension language for a C++ program with linux, from the >>> memory allocation point of view. >> >> On GNU/Linux, GC_INIT() is not required, so there is no issue there. > > Indeed. > >> If you want to pass C++ exceptions through C-code, there is a gcc >> option for that. > > It enables you to pass a C++ exception through (but not catch it in) C > code (in other words, it enables stack unwinding). However, I do not > think it enables you to throw C++ exceptions out of guile dynwind > blocks and end up with a sensible result (other than program > termination), since C++ exceptions use a different mechanism from > guile's exception jumps. Leaving aside the point that relying on the > gcc -fexceptions extension for C makes code non-portable, are you > saying it actually works with dynwind blocks? I recall the option puts C++ exception stacks in into the C code, so if all C translation units have it, throw-catch should work as normal in the C++ code. If you want to pass it through Guile code, say if main() is C++ with a try-catch construct, Guile must be recompiled with this option.