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] CamlIDL documentation and COM issues
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dbely@m...>
Subject: Re: [Caml-list] CamlIDL documentation and COM issues
Florian Hars <> writes:

>> It's easy:
>> typedef [abstract,finalize(FooClose)] void* FooHandle;
> Nice, now all I need is a debian package for camlidl 1.04 to get this
> working :-).
> But there are more things I cannot figure out reading the manual:
> The library I want to use contains constructs like
> typedef struct {
>    int numThings;
>    int *the1stThings;
>    int *the2ndThings;
>     /* more stuff */
> } FOOThing;
> Can I translate this to
> struct FOOThing {
>     [length_is(numThings)] int (*the1stThings) [];
>     [length_is(numThings)] int (*the2ndThings) [];
>      /* more stuff */
> };
> Will this work as expected? From a quick look at the machine generated
> C code, the answer seems to be yes, but the manual doesn't say much
> about how camlidl deals with the array/pointer ambiguity in C, except
> that it mentions (*x)[] as an example for the syntax of type
> declarations.

Your declaration is wrong, just look into generated C header
(camlidl -header). Why simply not to use

typedef struct {
   int numThings;
   [size_is(numThings)] int *the1stThings;
   [size_is(numThings)] int *the2ndThings;
    /* more stuff */
} FOOThing;


> And what is the difference between length_is() and size_is(), except
> that the latter is checked after the former?



> And who has to do the name mangling? FOOThing is no valid type or
> variable name in ocaml. It looks like camlidl just converts the first
> character to lowercase, but can I control this better? I can use
> [mlname="thing"] on struct fields, something like
> int [quote("_ret=FOOOperate(args...)")] operate(args...);
> for functions, but what about structs and typedefs? Wouldn't it be
> usefull to generalize the mlname attribute to all cases where names on
> both sides of the translation might be different?

Maybe. Ask Xavier Leroy if he's like this idea.

Hope to hear from you soon,

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: