Dear Caml riders, I am trying to access C++ code from OCaml. I have read http://caml.inria.fr/Hump/msg778-782 but then this message uses the interface prior to OCaml 3.00 so I have been trying to rewrite the example using custom blocks (also to eventually have the added sugar of comparison,...). It sort of work; I have problems with the Garbage Collector giving me a Segmentation fault. The code is attached below. If somebody is kind enough to have a look at the files and to point to me the mistake I made I will be very grateful. I also want to take opportunity of this message to mention another problem I met. To avoid name collisions, it is sometimes desirable to use a private namespace for Caml .h files, e.g.: namespace ml { extern "C" { #include #include #include #include #include } } This however has two consequences: * Some macros do not work anymore since the namespace is not "propagated" into the macros definitions. As a consequence, lost of macros need to be redefined which is not robust w.r.t. software upgrades... * One must know what is a macro and what if a function: for example on must write ml::value, ml::alloc_custom, and ml::custom_serialize_default but one stays with Field, String_val, and custom_deserialize_default Maybe future versions of the header files could solve this problem by adding automatically a prefix/namespace for C++ compilation, making everything a macro and making the macros compatible with the prefix (or maybe there is a better solution ?). Cheers, ChriS