From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Panicz Maciej Godek Newsgroups: gmane.lisp.guile.user Subject: Re: good tutorial on extending a c++ project with Guile ? Date: Mon, 26 Jun 2017 15:03:19 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1498482245 6684 195.159.176.226 (26 Jun 2017 13:04:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 13:04:05 +0000 (UTC) Cc: "guile-user@gnu.org" To: samuel.barreto8@gmail.com Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jun 26 15:03:58 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPTgK-0001Cm-B6 for guile-user@m.gmane.org; Mon, 26 Jun 2017 15:03:56 +0200 Original-Received: from localhost ([::1]:46539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPTgN-0004WV-Qr for guile-user@m.gmane.org; Mon, 26 Jun 2017 09:03:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPTfn-0004V9-CH for guile-user@gnu.org; Mon, 26 Jun 2017 09:03:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPTfm-0003Xo-GH for guile-user@gnu.org; Mon, 26 Jun 2017 09:03:23 -0400 Original-Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:35959) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPTfm-0003XI-AR for guile-user@gnu.org; Mon, 26 Jun 2017 09:03:22 -0400 Original-Received: by mail-wm0-x22b.google.com with SMTP id 62so669440wmw.1 for ; Mon, 26 Jun 2017 06:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=lXNGtYJKCDClHnLK/gFJEotv99KzWRSs6KgojAiOSiE=; b=ITXelbIUNN3Q4+KmclNTcqPWv//y97n7qCOXTdEMV0iwk1+Yr9EsEUxp9EZdjLgECA 0Fui6vejyNyadTb08BLIUbz7uxnNi963fCJxJQZj93Oh4HC1XExWoQeHG5NsVUr9jXZE WM+c4gGn1Vhiu2OdwusfbeQ462IpeB9ZzMMV6ANFlRCrTuSHEAvceedjmkcjG3rKo0or 7o0myvj87PQpYCEcWHndix6CnxARTWtUxzE2GNxfwWqqrr8nirX/fFn9fSosP7L8/M4j rQZVSf66J4IAZZVS/fd4GHkcW5f54j8VZmJabU4hJ+7Pk1nIF8yMfmsOZVv9fearKLfd Lm8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=lXNGtYJKCDClHnLK/gFJEotv99KzWRSs6KgojAiOSiE=; b=Q4LIm0M+hAxJrhjc7ib2yK8PdkHkscU1vzSmxGQUCSK+e6TCe0o4E4HeoytoPGKlsd MxDZ9qRvQbCkR8YU5RwGknjDG7BxWOo5Hmg2w7RRzHtoI+Mk0jPC3z8lAKsEY546+j12 T6bNMWQ4+WmhbSZxHyGtvHgbuDaJdeavSy9Hb/OQH/JMY6oYa2DwtfGf+wXChwH2u5j+ 7RF323rG2lupEkxKvClaN7kXW4auuexQyHtEbvCaglYy8ArZ14JjBm2PCnPvRxwh1TCy njfJCpSYpGSoq/MuVf4Qg0UAsLcuamYvOuYUk/AtMctCDBrrqAzxG7tKBa/yDJ8nUEz7 x/Iw== X-Gm-Message-State: AKS2vOzwf0eycZr2ftk4ED7+HGQIjwljLHW1WOcWufETYsn2zv7Ue32c Oa6kEtsW4JrTHFTxS/Cv1dUeni86OA== X-Received: by 10.80.155.19 with SMTP id o19mr57702edi.27.1498482199616; Mon, 26 Jun 2017 06:03:19 -0700 (PDT) Original-Received: by 10.80.145.214 with HTTP; Mon, 26 Jun 2017 06:03:19 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22b X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:13882 Archived-At: 2017-06-26 14:45 GMT+02:00 Samuel Barreto : > 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() // ... }