caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sylvain Kerjean <skerjean@irisa.fr>
To: caml-list@inria.fr
Subject: [Caml-list] interfacing with C++
Date: Mon, 28 Jan 2002 16:43:39 +0100	[thread overview]
Message-ID: <3C5571AB.CAB336F7@irisa.fr> (raw)

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


                 reply	other threads:[~2002-01-29 21:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C5571AB.CAB336F7@irisa.fr \
    --to=skerjean@irisa.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).