unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Panicz Maciej Godek <godek.maciek@gmail.com>
To: samuel.barreto8@gmail.com
Cc: "guile-user@gnu.org" <guile-user@gnu.org>
Subject: Re: good tutorial on extending a c++ project with Guile ?
Date: Mon, 26 Jun 2017 15:08:27 +0200	[thread overview]
Message-ID: <CAMFYt2Zuyrap-kgxzeyQsvBoYWhYipNr-bx18PCY5daQ=2msBw@mail.gmail.com> (raw)
In-Reply-To: <CAMFYt2ZoAi71py5D3QLHaOxeex+TiQ_doJG2jsjBJwCV3VZx8g@mail.gmail.com>

2017-06-26 15:03 GMT+02:00 Panicz Maciej Godek <godek.maciek@gmail.com>:

>
>
> 2017-06-26 14:45 GMT+02:00 Samuel Barreto <samuel.barreto8@gmail.com>:
>
>> 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	other threads:[~2017-06-26 13:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-26 12:45 good tutorial on extending a c++ project with Guile ? Samuel Barreto
2017-06-26 13:03 ` Panicz Maciej Godek
2017-06-26 13:08   ` Panicz Maciej Godek [this message]
2017-06-26 16:09 ` Hans Åberg
2017-06-26 16:54 ` David Kastrup
2017-06-26 18:42 ` Chris Vine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMFYt2Zuyrap-kgxzeyQsvBoYWhYipNr-bx18PCY5daQ=2msBw@mail.gmail.com' \
    --to=godek.maciek@gmail.com \
    --cc=guile-user@gnu.org \
    --cc=samuel.barreto8@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).