guile-user
[Top][All Lists]
Advanced

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

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


From: Panicz Maciej Godek
Subject: Re: good tutorial on extending a c++ project with Guile ?
Date: Mon, 26 Jun 2017 15:08:27 +0200

2017-06-26 15:03 GMT+02:00 Panicz Maciej Godek <address@hidden>:

>
>
> 2017-06-26 14:45 GMT+02:00 Samuel Barreto <address@hidden>:
>
>> 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()
>   // ...
> }
>
>
> I also have a working example of a library made to cooperate with Guile
using C++ here
(these are some bindings to the Open Dynamics Engine; I wrote them in C++
because this
way I could use some of the STL collections)

https://bitbucket.org/panicz/slayer/src/26a8b3ff05ad9d34a98a636d771e3875496f2d69/demos/scum/physics/?at=default


reply via email to

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