From: Luca de Alfaro <luca@dealfaro.org>
To: Michael Ekstrand <michael+ocaml@elehack.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: How to wrap around C++?
Date: Mon, 8 Feb 2010 08:03:15 -0800 [thread overview]
Message-ID: <7b0bd61a1002080803n6cda4bc5g9eeb8d559538598f@mail.gmail.com> (raw)
In-Reply-To: <hko2jm$r2a$1@ger.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1287 bytes --]
Thank you very much! I follow the general lines, but...
> * Make sure no C++ exceptions leak to OCaml.
>
This will be next to impossible: the C++ code I need to wrap is huge, and I
have no idea of what possible exceptions can be generated. I will have to
try to see if there is a generic exception catcher.
> * Wrap your OCaml includes in 'extern "C" { ... }"
>
Here, I am not sure what you mean. You mean,
extern "C" {
#include <caml/mlvalues.h>
...
}
?
> * Export all your stub functions with C linkage (extern "C")
>
Ok, evidently, I need to learn this extern "C" construct.
> * Compiling is tricky, since the OCaml compiler driver doesn't know what
> to do with C++. The Swig documentation[1] has a workaround for this,
> useful even if you don't use Swig.
>
>
Why would the Ocaml compiler driver need to know what to do with C++?
The C++ I need to link to is rather huge, and I will need to compile it with
its own build setup.
Once that is built, I need to compile the stubs, the Ocaml, and link the
three together (Ocaml, stubs, and C++), in native mode, but why would the
Ocaml compiler need to deal with C++?
Another question: I could also try to do the vice-versa, and use Ocaml as
libraries from C++. Has anybody tried doing this? Is it easy to do?
Luca
[-- Attachment #2: Type: text/html, Size: 2180 bytes --]
next prev parent reply other threads:[~2010-02-08 16:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-08 2:13 Luca de Alfaro
2010-02-08 4:06 ` Michael Ekstrand
2010-02-08 4:17 ` Michael Ekstrand
2010-02-08 16:03 ` Luca de Alfaro [this message]
2010-02-08 16:33 ` [Caml-list] " Luca de Alfaro
2010-02-08 17:44 ` Guillaume Yziquel
2010-02-08 17:57 ` Luca de Alfaro
2010-02-09 6:53 ` Basile STARYNKEVITCH
2010-02-08 17:54 ` Guillaume Yziquel
2010-02-09 0:25 ` Michael Ekstrand
2010-02-08 12:38 ` [Caml-list] " Guillaume Yziquel
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7b0bd61a1002080803n6cda4bc5g9eeb8d559538598f@mail.gmail.com \
--to=luca@dealfaro.org \
--cc=caml-list@inria.fr \
--cc=michael+ocaml@elehack.net \
/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