[Top][All Lists]

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

Re: good tutorial on extending a c++ project with Guile ?

From: Hans Åberg
Subject: Re: good tutorial on extending a c++ project with Guile ?
Date: Mon, 26 Jun 2017 18:09:57 +0200

> On 26 Jun 2017, at 14:45, Samuel Barreto <address@hidden> wrote:

> So can anyone point me to a good example or a simple tutorial on how to
> extend C++ with Guile ?

Long ago, I wrote [1], which includes a parser generated with Flex/Bison, and 
examples how to convert between Guile and C++ exceptions. According to 
discussions here before, it is bad idea passing C++ exceptions through C code.

One difference is that in general there is no way one can guarantee in a C++ 
interface that an integer staying the same when passed through Guile, as Scheme 
does not have a static integer and rational number types, but a single number 
type. So there need to be checks there.

> I think the main confusion point to me is the
> compilation [dance] between g++ and gcc.

C++ names are mangled, and 'extern "C"' drops that, so that the names can be 
combined with C. If you compile C with g++, I think it will assume it is 
compile it as C++ with name mangling then.

The Makefile of [1] compiles C++ with g++, but links using gcc with the option 
'-lstdc++', but perhaps it works using g++, as long it involves no C file 


reply via email to

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