From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 23DD5BBAF for ; Tue, 24 Aug 2010 20:22:09 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqwFAKaqc0xQDPIvYGdsb2JhbACSfo1ECxcLCAYUAx+gJZp7hTcEhDU X-IronPort-AV: E=Sophos;i="4.56,263,1280700000"; d="scan'208";a="55976807" Received: from smtp21.orange.fr ([80.12.242.47]) by mail3-smtp-sop.national.inria.fr with ESMTP; 24 Aug 2010 20:22:08 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2111.orange.fr (SMTP Server) with ESMTP id 6B3312000977 for ; Tue, 24 Aug 2010 20:22:08 +0200 (CEST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2111.orange.fr (SMTP Server) with ESMTP id 4D6922000BCA; Tue, 24 Aug 2010 20:22:08 +0200 (CEST) Received: from [172.24.131.5] (out1-1601fw.corp.tfbnw.net [66.220.144.27]) by mwinf2111.orange.fr (SMTP Server) with ESMTP id 75A222000977; Tue, 24 Aug 2010 20:22:07 +0200 (CEST) X-ME-UUID: 20100824182207481.75A222000977@mwinf2111.orange.fr X-ME-User-Auth: padator@wanadoo.fr Subject: Re: [Caml-list] how to call an OCaml library from C/C++ ? Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: Yoann Padioleau In-Reply-To: <1FEF5EC1-5F99-4400-A787-63A8352DDF85@wanadoo.fr> Date: Tue, 24 Aug 2010 11:22:05 -0700 Cc: caml users Content-Transfer-Encoding: quoted-printable Message-Id: <0EF0E664-A49F-4284-9163-61AA6C48C401@wanadoo.fr> References: <1FEF5EC1-5F99-4400-A787-63A8352DDF85@wanadoo.fr> To: Yoann Padioleau X-Mailer: Apple Mail (2.1078) X-Spam: no; 0.00; ocaml:01 ocaml:01 runtime:01 beginner's:01 bug:01 char:01 char:01 beginners:01 wrote:01 ideally:01 caml-list:01 caml-list:01 bin:01 caml:02 caml:02 On Aug 24, 2010, at 10:50 AM, Yoann Padioleau wrote: >=20 > Hi, >=20 > Is there a way to call OCaml library from a C/C++ program without the = C++ program > knowing it's OCaml code ? I mean I can not touch the main of the C++ = program > so it has to be completely transparent and it would be good if each = call to the ocaml library > once finished free all the memory it was using. > Can we call caml_startup() multiple times ? is there a caml_cleanup ? >=20 > Ideally I would like from C/C++ to have: >=20 >=20 > my_extension.c: > char* sanitize_stuff(char *s) { >=20 > caml_startup(); > char * res =3D ; > caml_cleanup(); > return res; > } Also it is possible to have multiple independent ocaml runtime at the = same time=20 so such a function is thread-safe ? >=20 > and then link my c++ program with my_extension.o and some .a = containing ocaml code. >=20 >=20 >=20 > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >=20