[C++-sig] Pyste suggestion: MSVC precompiled headers support

Nicodemus nicodemus at globalite.com.br
Sat Oct 18 00:20:10 CEST 2003


Hi Niall,

Niall Douglas wrote:

>>The generated file:
>>
>>// PCH 
>>=================================================================> #include "common.h"
>>#ifdef _MSC_VER
>>#pragma hdrstop
>>#endif
>>
>>// Includes 
>>=================================================================> #include <A.h>
>>...
>>    
>>
>
>The PCH file must be the FIRST include and the ONLY precompiled 
>header for v3.4 of GCC at least (I'm guessing they'll improve this 
>with time). For MSVC you can have as many headers as you like before 
>the #pragma hdrstop. It should be the user's responsibility to ensure 
>common.h includes <boost/python.hpp> and anything else.
>
>The above gives the maximum flexibility to users AFAICS. Comments 
>from the group?
>

I implemented this on CVS (sorry about the delay)... you can use 
PCHInclude with one or more parameters:

Class('A', 'A.h')
PCHInclude('common.h', 'common2.h')

will generate:

// PCH 
=========================================================================
#include <common.h>
#include <common2.h>
#ifdef _MSC_VER
#pragma hdrstop
#endif

// Includes 
====================================================================
#include <A.h>


If we comment out the PCHInclude function, we will get:

// Boost Includes 
==============================================================
#include <boost/python.hpp>
#include <boost/cstdint.hpp>

// Includes 
====================================================================
#include <A.h>


ie, the old behaviour. The user must include <boost/python.hpp> and 
<boost/cstdint.hpp> in the precompiled header for this scheme to work. 
Opinions?

Regards,
Nicodemus.





More information about the Cplusplus-sig mailing list