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
camlidl simple question with int types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-11-24 (18:26)
From: henri dubois-ferriere <henridf@g...>
Subject: camlidl simple question with int types
i am trying to use camlidl to translate c structs to ocaml.
say my c struct is:

typedef struct {
uint16_t addr; 
uint8_t group;
} msg;

I put this def in the .idl, and therefore must also do  "include
<stdint.h>"  from the idl.

Then, the mli-generated files will also contain the type definitions
for all other types in stdint.h (which is unnecessary but i guess
doesn't really matter).

Now, the problem is that camlidl also puts all the type definitions
from stdint.h in the .h file (call it header.h) that it generates.
Then, since the stubs.c file does an "include header.h" and also
includes some caml header files which then themselves pull in
sys/types.h, i get gcc warnings
like '
header.h:16: warning: redefinition of `int8_t'
/usr/include/sys/types.h:191: warning: `int8_t' previously defined here

of course, this should be ok, and i could probably disable the
appropriate gcc warning - but i assume that there is a cleaner way of 
doing all this from scratch?

Any tips/comments appreciated,