Version française
Home     About     Download     Resources     Contact us    
Browse thread
Conflict between config.h and system header
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Hezekiah M. Carty <hcarty@a...>
Subject: Re: [Caml-list] Conflict between config.h and system header
My apologies - I sent this to Daniel directly rather than to the list.

On 4/29/07, Daniel Bünzli <daniel.buenzli@epfl.ch> wrote:
> I have a conflict between the uint32 typedef of config.h and the
> system header Security.h on osx. Does anybody know how to work around
> this kind of problems (C compiler flag or preprocessor hack) ?

I can't get in to caml.inria.fr to see the relevant bug reports, but I
have similar issues with writing HDF library bindings.  I've ended up
using the following preprocessor lines in my C code to get around this
(the OCaml headers are included above the pasted code):

---BEGIN PASTE
// XXX BEGIN HORRIBLE HACK
#define int32 hdf_int32
#define uint32 hdf_uint32
#define int8 hdf_int8
#define uint8 hdf_uint8
#define int16 hdf_int16
#define uint16 hdf_uint16

#include <hdf.h>

#undef int32
#undef uint32
#undef int8
#undef uint8
#undef int16
#undef uint16
// XXX END HORRIBLE HACK
---END PASTE

I then have to use hdf_int32 and so on in the body of the code
occasionally to silence compiler warnings.

I don't know that this is the best way, but in my case it has allowed
me to do what I need to until a better solution comes along.

Hez