Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Compiling C++ in OCaml using Swig to native code
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-06-22 (10:46)
From: Tautrimas Pajarskas <tautrimas@t...>
Subject: Re: [Caml-list] Compiling C++ in OCaml using Swig to native code
On Sun, Jun 21, 2009 at 3:46 PM, Guillaume Yziquel <> wrote:

>  Hello.
>  I'm trying to access C++ code from OCaml using Swig. I successfully
>> compiled C++ code as a shared library through swig's C++ wrapper but
>> only in bytecode. Now, if I try the procedures listed in
>> for ocamlopt, I get an error:
> I'm sorry I can't help you, but you can help me: I'm also interested in
> binding C++ code to OCaml. Could I have a look at what you did so that I can
> have some guidance as to how to bind C++ code? I'd be perfectly happy with
> bytecode...

You can have a look at the Makefile ( If you
follow caller.byte (which is made from a simple ocaml source file for
calling c++ function from compiled library called md5wrapper.cma) you will
have all the instructions required to compile c++ library md5wrapper.cpp for
ocaml. For me, it was a good example of how to use multiple files with
bytecode. Native code still doesn't work and I still seek help.
If there is something unclear, just ask.

Tautrimas Pajarskas