caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Thomas Fischbacher <tf@functionality.de>
To: Oliver Kania <kania.oliver@googlemail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] embedding ocaml from C++ -- PODs
Date: Mon, 02 Jul 2007 12:49:27 +0100	[thread overview]
Message-ID: <4688E647.9030904@functionality.de> (raw)
In-Reply-To: <1262c4ee0707020406s7da99e37mc6706db8d35342a0@mail.gmail.com>


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


      parent reply	other threads:[~2007-07-02 11:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-02 11:06 Oliver Kania
2007-07-02 11:48 ` [Caml-list] " Richard Jones
     [not found]   ` <1262c4ee0707020509h48d43e24s5e8902810cae7985@mail.gmail.com>
2007-07-03  8:59     ` Richard Jones
2007-07-05 20:43       ` Oliver Kania
2007-07-02 11:49 ` Thomas Fischbacher [this message]

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=4688E647.9030904@functionality.de \
    --to=tf@functionality.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=kania.oliver@googlemail.com \
    /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).