unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Arun Isaac <theroarofthedragon@gmail.com>
To: guile-user@gnu.org
Subject: Re: C++ Foreign Function Interface
Date: Sat, 12 Mar 2016 01:47:49 +0530	[thread overview]
Message-ID: <87vb4s4vma.fsf@gmail.com> (raw)
In-Reply-To: <A08BF48F-4738-4B72-8F79-C3DBDE4BB822@telia.com> ("Hans \=\?utf-8\?Q\?\=C3\=85berg\=22's\?\= message of "Fri, 11 Mar 2016 18:09:47 +0100")

[-- Attachment #1: Type: text/plain, Size: 1054 bytes --]


Chris Vine <chris@cvine.freeserve.co.uk> writes:

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

I'm trying to use the GNU Radio library (written in C++) from scheme.
While I can't really modify the library itself, I can wrap functions I
need in C, and then call them using Guile's C FFI. I'll do that.

Hans Åberg <haberg-1@telia.com> writes:

> You will have to write it yourself. It has been discussed before on
> this list [1].

In one of the messages in the earlier thread, I found a link to
https://isocpp.org/wiki/faq/mixing-c-and-cpp

That page gives me some idea of how I can write C wrappers for my C++
library.


[-- Attachment #2.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

  reply	other threads:[~2016-03-11 20:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-10 18:18 C++ Foreign Function Interface Arun Isaac
2016-03-10 21:17 ` Chris Vine
2016-03-11 17:09 ` Hans Åberg
2016-03-11 20:17   ` Arun Isaac [this message]
2016-03-11 22:40     ` Hans Åberg
2016-03-14 16:04       ` Arun Isaac
2016-03-14 19:22         ` Chris Vine
2016-03-14 21:12           ` Jan Wedekind
2016-03-11 23:36     ` David Pirotte

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=87vb4s4vma.fsf@gmail.com \
    --to=theroarofthedragon@gmail.com \
    --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).