Browse thread
[Caml-list] Caml productivity.
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Xavier Leroy <xavier.leroy@i...> |
| Subject: | Re: [Caml-list] CamlIDL and function pointers |
> Thanks for the help. I have seen another approach mentioned, but have not
> been able to get it to work. I thought I could rewrite my struct for the
> IDL as:
>
> typedef strcut funp {
> int i;
> } funp_t;
>
> But leave the C version intact. Supposedly it would just ignore the other
> field when passing it through to Caml.
Yes, that's a useful trick. However, ignoring the other field
entirely doesn't do what you want when converting from Caml to C:
> If that's the case, I was thinking
> it might be possible to write the following in the IDL:
>
> void myfun ([in, unique] funp_t* f)
> quote(call,
> " _res = f->funp_fun ();");
Here, the CamlIDL-generated code will initialize f->i from the Caml
data, and leave f->funp_fun uninitialized. (Remember, CamlIDL doesn't
even *know* about the funp_fun field.) Hence, instant crash when you
do f->funp_fun().
- Xavier Leroy
-------------------
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