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 ... } ? > * 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