Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Caml productivity.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-25 (09:36)
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 Archives:
Bug reports: FAQ:
Beginner's list: