From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chris Vine Newsgroups: gmane.lisp.guile.user Subject: Re: C++ Foreign Function Interface Date: Thu, 10 Mar 2016 21:17:16 +0000 Message-ID: <20160310211716.58d94dc8@bother.homenet> References: <87a8m6nqm4.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1457644675 16254 80.91.229.3 (10 Mar 2016 21:17:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 10 Mar 2016 21:17:55 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Mar 10 22:17:40 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ae7xi-0001ry-Qj for guile-user@m.gmane.org; Thu, 10 Mar 2016 22:17:39 +0100 Original-Received: from localhost ([::1]:51355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae7xi-00075O-1l for guile-user@m.gmane.org; Thu, 10 Mar 2016 16:17:38 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae7xZ-000758-DJ for guile-user@gnu.org; Thu, 10 Mar 2016 16:17:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ae7xW-0003tB-7D for guile-user@gnu.org; Thu, 10 Mar 2016 16:17:29 -0500 Original-Received: from smtpout5.wanadoo.co.uk ([80.12.242.80]:50281 helo=smtpout.wanadoo.co.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ae7xW-0003ss-08 for guile-user@gnu.org; Thu, 10 Mar 2016 16:17:26 -0500 Original-Received: from bother.homenet ([95.146.111.202]) by mwinf5d64 with ME id UMHG1s00G4N3fKz03MHGoQ; Thu, 10 Mar 2016 22:17:23 +0100 X-ME-Helo: bother.homenet X-ME-Date: Thu, 10 Mar 2016 22:17:23 +0100 X-ME-IP: 95.146.111.202 Original-Received: from bother.homenet (localhost [127.0.0.1]) by bother.homenet (Postfix) with ESMTP id 508C6121289 for ; Thu, 10 Mar 2016 21:17:16 +0000 (GMT) In-Reply-To: <87a8m6nqm4.fsf@gmail.com> X-Mailer: Claws Mail 3.13.1 (GTK+ 2.24.29; i686-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.12.242.80 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 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-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:12469 Archived-At: On Thu, 10 Mar 2016 23:48:43 +0530 Arun Isaac wrote: > Hi, > > Is there any foreign function interface for C++ shared libraries in > Guile? Can I somehow use the C FFI for this? Is there any > documentation for this? If you want to link with a C++ library when using libguile (and, say, want to make functions in the library accessible to scheme code using scm_c_define_gsubr()), then you need to declare interface functions as extern "C" so they have C language linkage. That will amongst other things suppress name mangling and make sure the correct calling convention is used. The same applies if you are planning to use, say, pointer->procedure. Chris