2017-06-26 14:45 GMT+02:00 Samuel Barreto <[email protected]>:

> Hi everyone,
>
> I want to create a Guile extension to a big C++-based project called
> Bio++ (dedicated to bioinformatics and computational biology).
>
> However I failed to find a good and simple example on how to extend a
> C++ program with Guile. My idea was to create a shared library that can
> be called from Guile and embedded in a module. I followed instructions
> on the Guile reference manual but all of them are related to C, not C++.
> I then looked at the source code of LilyPond and OpenCog but was not
> able to extract signal from software idiosyncratic noise.
>
> So can anyone point me to a good example or a simple tutorial on how to
> extend C++ with Guile ? I think the main confusion point to me is the
> compilation danse between g++ and gcc.
>
>
Hi Samuel,
I think that the tutorial from the Guile reference manual should be
sufficient,
as C++ is mostly a superset of C -- you only need to be careful about
making the
loadable functions binary-compatible with C, by marking them
extern "C". You can do this per function, by writing, say

extern "C" void init_bessel();

or per module, as in

extern "C" {
  // ...
  void init_bessel()
  // ...
}

Reply via email to