caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dbely@mail.ru>
To: caml-list@inria.fr
Subject: Re: [Caml-list] CamlIDL documentation and COM issues
Date: Sat, 08 Jun 2002 23:16:19 +0400	[thread overview]
Message-ID: <fzzxd1j0.fsf@mail.ru> (raw)
In-Reply-To: <3D00B929.5020002@bik-gmbh.de> (Florian Hars's message of "Fri, 07 Jun 2002 15:46:17 +0200")

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?

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


      reply	other threads:[~2002-06-08 19:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-04 16:28 Florian Hars
2002-06-04 17:23 ` Dmitry Bely
2002-06-07 13:46   ` Florian Hars
2002-06-08 19:16     ` Dmitry Bely [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fzzxd1j0.fsf@mail.ru \
    --to=dbely@mail.ru \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).