From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 76C21BC37 for ; Mon, 8 Feb 2010 17:34:10 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqABAErMb0vRVd3CkGdsb2JhbACbBTwBAQEBCQkMBxMDvAqEVAQ X-IronPort-AV: E=Sophos;i="4.49,431,1262559600"; d="scan'208";a="56319700" Received: from mail-qy0-f194.google.com ([209.85.221.194]) by mail4-smtp-sop.national.inria.fr with ESMTP; 08 Feb 2010 17:33:41 +0100 Received: by qyk32 with SMTP id 32so1170558qyk.12 for ; Mon, 08 Feb 2010 08:33:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.107.32 with SMTP id z32mr689619qco.81.1265646821160; Mon, 08 Feb 2010 08:33:41 -0800 (PST) X-Originating-IP: [63.203.46.196] In-Reply-To: <7b0bd61a1002080803n6cda4bc5g9eeb8d559538598f@mail.gmail.com> References: <28fa90931002071813k7330ad34s7a2ec8b4cf1c3d11@mail.gmail.com> <7b0bd61a1002080803n6cda4bc5g9eeb8d559538598f@mail.gmail.com> Date: Mon, 8 Feb 2010 08:33:41 -0800 Message-ID: <28fa90931002080833y2ca71705q319a3193d3e75d9f@mail.gmail.com> Subject: Re: [Caml-list] Re: How to wrap around C++? From: Luca de Alfaro To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=00235429d8fc2fba78047f195d72 X-Spam: no; 0.00; ocaml:01 arrays:01 arrays:01 ocaml:01 garbage:01 garbage:01 caml-list:01 tuples:01 tuples:01 int:01 int:01 string:02 string:02 seems:03 seems:03 --00235429d8fc2fba78047f195d72 Content-Type: text/plain; charset=ISO-8859-1 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... Luca --00235429d8fc2fba78047f195d72 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I am trying another approach... it might make more sense for me to embed th= e Ocaml into C++.=A0
I have read the instructions, and it seems feasibl= e, except that I have a few questions:
  • All I need to pass, as ar= guments, are int, float, string, and arrays of these. =A0Any example of how= to deal with the arrays?=A0
  • How can I return arrays, in a way that C or C++ understands? =A0How can= I return tuples, i.e., how can I return multiple values from Ocaml to C?= =A0
  • Finally, do I need to worry about the Ocaml garbage collector, = if I call Ocaml from C/C++? =A0Will it run every now and then? How can the = garbage collector know whether a value returned by an Ocaml function is sti= ll being used in C/C++? =A0How can I tell it that it is no longer used?=A0<= /li>
The problem I am trying to solve seems to be a can of worms from = whichever angle I take it...=A0

Luca
--00235429d8fc2fba78047f195d72--