unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: guile-user@gnu.org
Subject: Re: good tutorial on extending a c++ project with Guile ?
Date: Mon, 26 Jun 2017 18:54:21 +0200	[thread overview]
Message-ID: <87fuem7kqq.fsf@fencepost.gnu.org> (raw)
In-Reply-To: m2y3se3okt.fsf@umr5557-mendel-sbar.univ-lyon1.fr

Samuel Barreto <samuel.barreto8@gmail.com> writes:

> 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.

You could take a look at LilyPond (which still uses Guile-1.8 but the
1.8/2.x difference is not really relevant to the basic approaches used
for interfacing), is written in C++ and interfaces to Guile (with Guile
being precompiled as a C library and used as system library if
available).

In particular, it might make sense to look at the files lily/smobs.cc,
lily/include/smobs.hh, lily/include/smobs.tcc,
lily/include/small-smobs.hh since LilyPond routes all its Scheme-wrapped
data structures through these constructs.

A repository viewer can be found at
<http://git.savannah.gnu.org/gitweb/?p=lilypond.git;a=tree>

-- 
David Kastrup




  parent reply	other threads:[~2017-06-26 16:54 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
2017-06-26 16:09 ` Hans Åberg
2017-06-26 16:54 ` David Kastrup [this message]
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=87fuem7kqq.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=guile-user@gnu.org \
    /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).