From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?utf-8?Q?Hans_=C3=85berg?= Newsgroups: gmane.lisp.guile.user Subject: Re: good tutorial on extending a c++ project with Guile ? Date: Mon, 26 Jun 2017 18:09:57 +0200 Message-ID: <454E05B5-B2A2-4074-9873-84C5A6F9356F@telia.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1498493431 1201 195.159.176.226 (26 Jun 2017 16:10:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 16:10:31 +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 18:10:22 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 1dPWaj-0008B6-2x for guile-user@m.gmane.org; Mon, 26 Jun 2017 18:10:21 +0200 Original-Received: from localhost ([::1]:47486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPWao-0002EL-3P for guile-user@m.gmane.org; Mon, 26 Jun 2017 12:10:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPWaS-0002ED-4l for guile-user@gnu.org; Mon, 26 Jun 2017 12:10:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPWaO-0002yv-1F for guile-user@gnu.org; Mon, 26 Jun 2017 12:10:04 -0400 Original-Received: from v-smtpout3.han.skanova.net ([81.236.60.156]:40524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPWaN-0002yf-RC for guile-user@gnu.org; Mon, 26 Jun 2017 12:09:59 -0400 Original-Received: from [10.0.1.4] ([90.227.203.185]) by cmsmtp with SMTP id PWaLdaq7OARCaPWaMdSTkJ; Mon, 26 Jun 2017 18:09:58 +0200 In-Reply-To: X-Mailer: Apple Mail (2.3273) X-CMAE-Envelope: MS4wfOAkNH+866TXwGtaNUhcOMjGFf/oSykE+aJoVAR+Hlvyk6bu2b8+pF+pC8lduRwcW9Ntvg2mxEN+7AZJTMNLp+bctPV0i+PLVka2oWM0mJtOMKSI//lj vAVQMPjJgsS6dB9gc9qTb9tTbalhWemBb71ys5srF8v0LuKYKoOKx6G09KmByYasTUQjNgVoHbseXE88BbRqRtcY+gZEoIDU40E= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (barebone) [generic] [fuzzy] X-Received-From: 81.236.60.156 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:13885 Archived-At: > On 26 Jun 2017, at 14:45, Samuel Barreto = wrote: > So can anyone point me to a good example or a simple tutorial on how = to > extend C++ with Guile ? Long ago, I wrote [1], which includes a parser generated with = Flex/Bison, and examples how to convert between Guile and C++ = exceptions. According to discussions here before, it is bad idea passing = C++ exceptions through C code. One difference is that in general there is no way one can guarantee in a = C++ interface that an integer staying the same when passed through = Guile, as Scheme does not have a static integer and rational number = types, but a single number type. So there need to be checks there. > I think the main confusion point to me is the > compilation [dance] between g++ and gcc. C++ names are mangled, and 'extern "C"' drops that, so that the names = can be combined with C. If you compile C with g++, I think it will = assume it is compile it as C++ with name mangling then. The Makefile of [1] compiles C++ with g++, but links using gcc with the = option '-lstdc++', but perhaps it works using g++, as long it involves = no C file compiling. 1. = https://secure2.storegate.com/Shares/Home.aspx?ShareID=3D56659ce2-127e-455= e-ba1f-e6cbc82ba973