From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: David Kastrup Newsgroups: gmane.lisp.guile.user Subject: Re: good tutorial on extending a c++ project with Guile ? Date: Mon, 26 Jun 2017 18:54:21 +0200 Organization: Organization?!? Message-ID: <87fuem7kqq.fsf@fencepost.gnu.org> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1498496118 12243 195.159.176.226 (26 Jun 2017 16:55:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 16:55:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Jun 26 18:55:14 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 1dPXI9-0002uX-9O for guile-user@m.gmane.org; Mon, 26 Jun 2017 18:55:13 +0200 Original-Received: from localhost ([::1]:47659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPXIE-0000zi-8Q for guile-user@m.gmane.org; Mon, 26 Jun 2017 12:55:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPXHb-0000xY-N2 for guile-user@gnu.org; Mon, 26 Jun 2017 12:54:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPXHY-0006YG-L5 for guile-user@gnu.org; Mon, 26 Jun 2017 12:54:39 -0400 Original-Received: from [195.159.176.226] (port=46765 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPXHY-0006XN-E2 for guile-user@gnu.org; Mon, 26 Jun 2017 12:54:36 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dPXHQ-0000j6-GV for guile-user@gnu.org; Mon, 26 Jun 2017 18:54:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 34 Original-X-Complaints-To: usenet@blaine.gmane.org X-Face: 2FEFf>]>q>2iw=B6, xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN; i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw Cancel-Lock: sha1:w9gzMWFZ011NwFVS7V7TCMVaXPc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:13886 Archived-At: Samuel Barreto 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 -- David Kastrup