[Python-Dev] more-precise instructions for "Python.h first"?

David Abrahams dave@boost-consulting.com
Sat, 31 May 2003 10:35:27 -0400


Boost.Python is now trying hard to accomodate the "Python.h before
system headers rule".  Unfortunately, we still need a wrapper around
Python.h, at least for some versions of Python, so that we can
work around some issues like:

    //
    // Python's LongObject.h helpfully #defines ULONGLONG_MAX for us
    // even when it's not defined by the system which confuses Boost's
    // config
    //

To cope with that correctly, we need to see <limits.h> (a system
header) before longobject.h.  Currently, we're including <limits.h>,
then <patchlevel.h>, well, and then the wrapper gets a little
complicated adjusting for various compilers.

Anyway, the point is that I'd like to have the rule changed to "You
have to include Python.h or xxxx.h before any system header" where
xxxx.h is one of the other existing headers #included in Python.h that
is responsible for setting up whatever macros cause this
inclusion-order requirement in the first place (preferably not
LongObject.h!)  That way I might be able to get those configuration
issues sorted out without violating the #inclusion order rule.  What
I have now seems to work, but I'd rather do the right thing (TM).

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com