<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/07/348514c77483a81afd734d23858d5f77"
  from="Mary Fernandez &lt;mff@r...&gt;"
  author="Mary Fernandez"
  date="2003-07-17T15:25:28"
  subject="[Caml-list] Two questions about using the CamlIDL"
  prev="2003/07/ccd92eb3783074eb7e12bf2b325ce13c"
  next="2003/07/0b7f43c027ae0ddfa89dde1ef71f3a84"
  next-in-thread="2003/07/c3abb130a34e05c89945e77f613ee37a"
  prev-thread="2003/07/ccd92eb3783074eb7e12bf2b325ce13c"
  next-thread="2003/07/342f857b4e404c7db28559ad8cefffb0"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] Two questions about using the CamlIDL">
<msg 
  url="2003/07/348514c77483a81afd734d23858d5f77"
  from="Mary Fernandez &lt;mff@r...&gt;"
  author="Mary Fernandez"
  date="2003-07-17T15:25:28"
  subject="[Caml-list] Two questions about using the CamlIDL">
<msg 
  url="2003/07/c3abb130a34e05c89945e77f613ee37a"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-07-17T20:27:43"
  subject="Re: [Caml-list] Two questions about using the CamlIDL">
<msg 
  url="2003/07/dab979091d49d8282ce0ef1bf019d413"
  from="Mary Fernandez &lt;mff@r...&gt;"
  author="Mary Fernandez"
  date="2003-07-18T16:49:44"
  subject="Re: [Caml-list] Two questions about using the CamlIDL">
</msg>
</msg>
</msg>
</thread>

<contents>
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 &lt;mff@research.att.com&gt;
AT&amp;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

</contents>

</message>

