From: Xavier Leroy <xavier.leroy@inria.fr>
To: Shishir Ramam <sramam@yahoo.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Using Ocaml keywords as structure members.
Date: Thu, 17 Jun 2004 22:00:51 +0200 [thread overview]
Message-ID: <20040617220051.A14078@pauillac.inria.fr> (raw)
In-Reply-To: <20040616171022.31544.qmail@web52804.mail.yahoo.com>; from sramam@yahoo.com on Wed, Jun 16, 2004 at 10:10:22AM -0700
> I am interesting in converting a data-structure from
> C to Ocaml using CamlIdl. I am running into some
> trouble because one of the structure members is
> named "end".
> Apart from renaming the structure member in
> C (3rd party, lotsa work!), is there anything else
> that I can do?
Yes: use the "mlname" attribute. In the IDL file:
struct a_test {
int start;
[mlname(end_)] int end;
};
> A common C coding convention is to use
> struct definitions of the form -
>
> <test.idl> ---------
>
> typedef struct a {
> int x;
> int y;
> } a;
>
> </test.idl> --------
> Using CamlIdl, this results in a conversion to [incorrect Caml code]
I'd suggest to change the IDL file (and only the IDL file) to either
typedef struct {
int x;
int y;
} a;
// use "a" instead of "struct a" everywhere else
or
struct a {
int x;
int y;
};
// use "struct a" instead of "a" everywhere else
Note that I'm not suggesting you do this change in the .c and .h
sources for the original C code. IDL descriptions can (and often need
to) omit some aspects of the C interface they describe.
- Xavier Leroy
-------------------
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
prev parent reply other threads:[~2004-06-17 20:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-16 15:41 [Caml-list] Linear constraints Claudio Trento
2004-06-16 16:27 ` Boulet Pierre
2004-06-16 17:10 ` [Caml-list] Using Ocaml keywords as structure members Shishir Ramam
2004-06-17 20:00 ` Xavier Leroy [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=20040617220051.A14078@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=sramam@yahoo.com \
/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