Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
How to wrap around C++?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-02-08 (16:34)
From: Luca de Alfaro <luca@d...>
Subject: Re: [Caml-list] Re: How to wrap around C++?
I am trying another approach... it might make more sense for me to embed the
Ocaml into C++.
I have read the instructions, and it seems feasible, except that I have a
few questions:

   - All I need to pass, as arguments, are int, float, string, and arrays of
   these.  Any example of how to deal with the arrays?
   - How can I return arrays, in a way that C or C++ understands?  How can I
   return tuples, i.e., how can I return multiple values from Ocaml to C?
   - Finally, do I need to worry about the Ocaml garbage collector, if I
   call Ocaml from C/C++?  Will it run every now and then? How can the garbage
   collector know whether a value returned by an Ocaml function is still being
   used in C/C++?  How can I tell it that it is no longer used?

The problem I am trying to solve seems to be a can of worms from whichever
angle I take it...