>>>>> "JK" == Jim King <[EMAIL PROTECTED]> writes:

 >> > > extern "C" {
 >> > > #include <header_with_cpp_bogons.h>
 >> > > }

 JK> You're right, my bad.  Son of a gun, I've used 'extern "C"' for gobs of
 JK> stuff but I guess I never ran into C header files that had C++ reserved
 JK> words.

 JK> In that case, although it's considerably more work I'd take a look at
 JK> writing some C wrappers around the offending stuff.  You could write the
 JK> wrappers such that they'd compile with the offending include file, and be
 JK> callable from C++.  Sounds tedious and time consuming, but it might be
 JK> quicker than waiting for someone to fix the headers in question.

Here's something that *might* work:

extern "C" { // For function definitions
#define class c_class
#include <bad_header.h>
#undef class
}

After this, you just use the struct as usual, but call the class field 
c_class in your source. The name shouldn't matter, since it's just an
offset in the struct anyway ...

Of course, it woulde be better to have the bad header fixed, but as
Jim says, that probably will take some time ...

If the bad header uses any other words that is reserved in C++, they
can be handled in the same way ...

-- 
Rasmus Kaj -------------------- [EMAIL PROTECTED] - http://Raditex.se/~kaj/
 \                             Pro is to con as progress is to Congress
  \------------------------------------------------- http://Raditex.se/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-stable" in the body of the message

Reply via email to