I faced a similar problem (Perl does have a tendency to crap cpp macros everywhere). My solution was to make an "unperl.h" file that I include at the top of the Inline code. It #undefs everything that conflicts with my headers. This isn't guaranteed to work; your Inline code could use a macro that depends on a Perl macro that you've undef'd. But it's been ok for me.
On Mon, Jun 9, 2008 at 10:49 AM, Nicholas Clark <[EMAIL PROTECTED]> wrote: > On Wed, May 28, 2008 at 06:04:09PM +0800, Kaiwang Chen wrote: >> Hello, >> >> Inline::C automatically includes some header files, one of which has >> typedef conflicts with my custom definition(see bellow). Is there some >> way to disable inclusion of certain system header files? Thanks in >> advance. > >> $ ./inline.pl >> /usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp >> -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap inline_pl_1ecd.xs > >> inline_pl_1ecd.xsc && mv inline_pl_1ecd.xsc inline_pl_1ecd.c >> gcc -c -I/home/kwchen/tmp -D_REENTRANT -D_GNU_SOURCE >> -fno-strict-aliasing -pipe -Wdeclaration-after-statement >> -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 >> -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 >> -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 >> -mtune=generic -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC >> "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" >> inline_pl_1ecd.c >> inline_pl_1ecd.xs:6: error: conflicting types for ???U8??? >> /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/handy.h:148: >> error: previous declaration of ???U8??? was here >> make: *** [inline_pl_1ecd.o] Error 1 > > That's not a system header. That's a header that's part of the Perl core, > which (unfortunately) means that it's necessary to the workings of Inline. > So there isn't going to be a way to suppress its inclusion. > > I think to make this work you'll need to make some sort of trivially thin > wrapper functions that have function declarations in a header file that > includes neither conflicting definition of U8. That way you can wrap those > wrappers with Inline::C (which includes Perl's definition of U8), but declare > them in a file that include the other headers that define U8. You'll need to > get Inline to link to the object file created from the wrapper function file, > which I'm not sure how to do, but can be done. > > Nicholas Clark >