From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id EB64ABC69 for ; Mon, 2 Jul 2007 13:49:10 +0200 (CEST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l62BnAZR028211 for ; Mon, 2 Jul 2007 13:49:10 +0200 Received: from [141.84.136.30] (helo=[152.78.96.56]) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis), id 0ML31I-1I5KOx3GGy-000455; Mon, 02 Jul 2007 13:49:08 +0200 Message-ID: <4688E647.9030904@functionality.de> Date: Mon, 02 Jul 2007 12:49:27 +0100 From: Thomas Fischbacher User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060607 Debian/1.7.12-1.2 X-Accept-Language: en MIME-Version: 1.0 To: Oliver Kania Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] embedding ocaml from C++ -- PODs References: <1262c4ee0707020406s7da99e37mc6706db8d35342a0@mail.gmail.com> In-Reply-To: <1262c4ee0707020406s7da99e37mc6706db8d35342a0@mail.gmail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+ZX93uxNfvG/97slDa/TMQ5r+h8tBdzvLyC4u fvdSvjBu87E7UkHZoFwtRjCUKhKTzwmogqrUpajSs74pj1yy3W q7xnrhwhIoud2NmDo77/A== X-Miltered: at concorde with ID 4688E636.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 accessors:01 conceptually:01 syntax:01 accessors:01 wrote:01 oliver:01 caml-list:01 functions:01 functions:01 lisp:01 data:02 data:02 objects:02 Oliver Kania wrote: > the OCAML documentation gives good explanation about how call OCAML > functions from C. > However , what I want to do is the following. I have a C structure with > many fields. > I want to be able to initialize this structure both in C and in Ocaml > and want access to the same instance from both languages. > The structure could be a global object in OCAML and C. The important > point is that I want to have access to the very same > data and not to any copies, which means I want to pass a reference from > OCAML to C or vice versa. > More generally speaking, I would like to create objects in C and pass > references to these objects to the OCAML side and vice versa. > Its all about data flow between the two sides. Well, all accessors should conceptually be functions, not just some weird special syntax. Perl "resolved" that issue through the introduction of "magic", Python has something equivalent, and in Lisp, the question des not arise in the first place, because all accessors already are functions. Just wrap up a couple of set_ and get_ functions and you will be fine. -- best regards, Thomas Fischbacher tf@functionality.de