From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA20505; Tue, 29 Jan 2002 22:42:55 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA19368 for caml-list@pauillac.inria.fr; Tue, 29 Jan 2002 22:42:55 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA28172 for ; Mon, 28 Jan 2002 16:43:40 +0100 (MET) Received: from feu.irisa.fr (feu.irisa.fr [131.254.60.80]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g0SFhdj26723 for ; Mon, 28 Jan 2002 16:43:39 +0100 (MET) Received: from irisa.fr (sigzag.irisa.fr [131.254.12.93]) by feu.irisa.fr (8.11.4/8.11.4) with ESMTP id g0SFhdN08947 for ; Mon, 28 Jan 2002 16:43:39 +0100 (MET) Message-ID: <3C5571AB.CAB336F7@irisa.fr> Date: Mon, 28 Jan 2002 16:43:39 +0100 From: Sylvain Kerjean Organization: IRISA, Campus de Beaulieu, 35042 Rennes Cedex, FRANCE X-Mailer: Mozilla 4.79 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: fr-FR, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] interfacing with C++ Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk let me share my experience : believe it or not but i am able to create and manipulate windows and menu bars under BeOS frome OCaml :) i modify some files in the compiler (adding some extern "C" stuff in mlvalues.h etc) i recompile my ocaml compiler , all is ok. I compile the following files with the good options, all works well. When i run my programs all is ok except that i get some seg fault when my programs create lots of new instances. Maybe it comes from the register_global_root ? Any idea ? i have two files one in C++ , one in ocaml (here are only the skeletons): file.ml ------------ type b ;; (* abstract type representing value encapsulating pointer to a C++ instance*) external be : unit -> b = "be" class cl = object val interne = be () end;; file.c++ ------------- extern "C" { value be(value unit); } value be(value unit) { CAMLparam1(unit); CAMLlocal1(be); be = alloc(1, Abstract_tag); register_global_root(&be); Store_field(be, 0, (value) new CL()); CAMLreturn(be) } -- Sylvain Kerjean IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France Tél: +33 (0) 2 99 84 75 99, Fax: +33 (0) 2 99 84 71 71 ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr