caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] interfacing with C++
@ 2002-01-28 15:43 Sylvain Kerjean
  0 siblings, 0 replies; only message in thread
From: Sylvain Kerjean @ 2002-01-28 15:43 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-29 21:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-28 15:43 [Caml-list] interfacing with C++ Sylvain Kerjean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).