English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2002-06-08 (19:25)
From: Dmitry Bely <dbely@m...>
Subject: Re: [Caml-list] CamlIDL documentation and COM issues
Florian Hars <hars@bik-gmbh.de> 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 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