caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mary Fernandez <mff@research.att.com>
To: caml-list@inria.fr
Cc: "Ricardo H. Medel" <rmedel@research.att.com>,
	Kathleen S Fisher <kfisher@research.att.com>,
	Robert E Gruber <gruber@research.att.com>
Subject: [Caml-list] Two questions about using the CamlIDL
Date: 17 Jul 2003 11:26:33 -0400	[thread overview]
Message-ID: <1058455592.1492.73.camel@squeak.research.att.com> (raw)

Thanks to everyone who has helped us with earlier questions.

We have 2 new questions regarding use of the Caml IDL.  

Our Caml application is unusual in that the Caml
app calls C functions, which in turn may call
Caml functions that return Caml objects to C, 
which in turn return those Caml objects back to the 
Caml app.  

1. It is not clear how to use the CamlIDL type syntax 
to define the type of a Caml value that will be returned from C.
We tried:

  typedef [abstract] value CamlObj
  
  CamlObj c_function()

assuming that on the C-side, the type of a caml object
would be represented by the type value (as defined
in caml/memory.h) But this does not compile.
Is it possible to express such a type?

2. Assuming we can specify the above type, the c_function 
that calls back into Caml will look something like this:

  CamlObj c_function() { 
    CAMLparam0();
    CAMLlocal2(caml_obj, args);

    ... Usual set up to get pointer to Caml function 
    and allocate space for args ...
    
    caml_obj = callbackN(*caml_function_closure, 0, args)

    CAMLreturn(caml_obj);
  }

Because c_function will be called from the IDL stub functions,
do we have to modify the stub functions to follow the same
function-call protocol as above? Unless the IDL compiler recognizes
that c_function is returning a Caml object, I am assuming that
we do.  One point: the caml_obj is only propogated back to the 
Caml app, i.e., there is never a pointer from the C heap to
that object.

Thanks a lot!
Mary

-- 
Mary Fernandez <mff@research.att.com>
AT&T Labs - Research

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


             reply	other threads:[~2003-07-17 15:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-17 15:26 Mary Fernandez [this message]
2003-07-17 20:27 ` Xavier Leroy
2003-07-18 16:06   ` Mary Fernandez

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=1058455592.1492.73.camel@squeak.research.att.com \
    --to=mff@research.att.com \
    --cc=caml-list@inria.fr \
    --cc=gruber@research.att.com \
    --cc=kfisher@research.att.com \
    --cc=rmedel@research.att.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).