From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA18970; Sat, 8 Jun 2002 21:25:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA18965 for ; Sat, 8 Jun 2002 21:25:19 +0200 (MET DST) Received: from relay.rinet.ru (relay.rinet.ru [195.54.192.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g58JPHH14222 for ; Sat, 8 Jun 2002 21:25:17 +0200 (MET DST) Received: (from uucp@localhost) by relay.rinet.ru (8.11.6/8.11.6) with UUCP id g58JPHK05485 for caml-list@inria.fr; Sat, 8 Jun 2002 23:25:17 +0400 (MSD) X-Envelope-To: caml-list@inria.fr Received: from bely.stormoff (BELY) [192.168.0.10] by stormoff with esmtp (Exim 3.12 #1 (Debian)) id 17GlhH-0004vc-00; Sat, 08 Jun 2002 23:16:23 +0400 X-Comment-To: Florian Hars To: caml-list@inria.fr Subject: Re: [Caml-list] CamlIDL documentation and COM issues References: <3CFCEAB6.5040204@hars.de> <8z5vq7pj.fsf@mail.ru> <3D00B929.5020002@bik-gmbh.de> From: Dmitry Bely Date: Sat, 08 Jun 2002 23:16:19 +0400 In-Reply-To: <3D00B929.5020002@bik-gmbh.de> (Florian Hars's message of "Fri, 07 Jun 2002 15:46:17 +0200") Message-ID: User-Agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.4 (Economic Science (Windows [1]), i586-pc-win32) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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? See http://msdn.microsoft.com/library/en-us/midl/mi-laref_1r1h.asp :-) > 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, Dmitry ------------------- 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