Browse thread
[Caml-list] Linear constraints
-
Claudio Trento
-
Boulet Pierre
-
Shishir Ramam
- Xavier Leroy
-
Shishir Ramam
-
Boulet Pierre
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2004-06-17 (20:00) |
From: | Xavier Leroy <xavier.leroy@i...> |
Subject: | Re: [Caml-list] Using Ocaml keywords as structure members. |
> 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