Boost logo

Boost :

Subject: Re: [boost] [tr1] Help needed with Darwin port
From: Stuart A. Malone (samalone_at_[hidden])
Date: 2009-01-13 13:37:12


John,

After reading your response and thinking about this problem a bit
longer, I've come up with two other possible workarounds if the
#include_next solution doesn't work.

Solution 1. Create a subdirectory called something like "bridges".
For each stdc++ header that you need to include, create a bridge
header in this subdirectory whose name is _not_ the same as the name
of the original header. It might look something like this:

File <boost/tr1/iostream>:

        #include <boost/tr1/bridges/iostream-bridge.hpp>

File <boost/tr1/bridges/iostream-bridge.hpp>:

        #include <iostream>

I _think_ that the #include in the bridge header will reliably locate
the original stdc++ <iostream> header, since there is no file named
"iostream" in the current directory and the bridges directory is not
on the search path.

Solution 2. Include some stdc++ header that is _not_ being redefined,
and then use the value of __GLIBCXX__ to determine the path to the
other headers.

        #if defined(__GLIBCXX__)
          #if __GLIBCXX__ == 20050421
            #include <c++/4.0.0/iostream>
          #elif __GLIBCXX__ > 20050421
            #include <c++/4.2.1/iostream>
          #else
            #error Unknown version of the GCC stdc++ library
          #endif
        #endif

I certainly don't recommend this since it is so fragile, but a
solution like this might work if nothing else does. Let me know if
you choose to go this route and I'll try to come up with the possible
values of __GLIBCXX__ for you and the corresponding paths.

I'd also be happy to do a few test builds for you once you think
you've come up with a solution, since we do have a vested interest in
this working correctly. ;)

--Stuart


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk