Here is a more complete example demonstrating: (1) destructors of global objects being called correctly on exit; (2) translation of C++ exceptions to Caml exceptions; (3) catching a C++ exception generated by a C++ primitive called through a Caml callback. The only trick is that if you really need (3), you have to modify libcamlrun.a (found in ocaml-1.07/byterun) as follows: - Insert `extern "C" {' at the beginning of interp.c and callback.c - Insert `}' at the end of interp.c and callback.c - Compile interp.c and callback.c with g++ (This will add ".eh_frame" sections which are required for exceptions handling): g++ -O -fno-defer-pop -Wall -c interp.c -o interp.o g++ -O -fno-defer-pop -Wall -c callback.c -o callback.o - Compile everything else normally (make libcamlrun.a) The Makefile assumes that the modified libcamlrun.a is in /tmp/ocaml-1.07/byterun/. This was tested with ocaml-1.07 and g++-2.8.1. Again, things seem to have improved a lot since gcc-2.7. - Pascal Brisset +33296051928 - - France Telecom CNET DTL/MSV | 2 av Pierre Marzin | F-22307 Lannion -