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

Nicodemus nicodemus at globalite.com.br
Fri Oct 10 01:27:50 CEST 2003


Niall Douglas wrote:

>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>On 8 Oct 2003 at 18:27, Nicodemus wrote:
>
>
>>#include <boost/python.hpp>
>>#include <boost/cstdint.hpp>
>>#ifdef _MSC_VER
>>#pragma hdrstop
>>#endif
>>#include <A.h>
>>
>>works for me. I thought that everything before #hdrstop would be
>>*included* in the pre-compiled header, not excluded. But I don't see
>>that happening, the code compiles fine.
>>
>
>Try generating a .pch file from some completely unrelated piece of 
>code. Then try compiling the above using that pch file instead. You 
>should get lots of errors.
>

Hmm, thanks for clarifying.

>>>If you could always get pyste to start off with *exactly* the same 
>>>#include's in the same order across all modules, then we don't need 
>>>this feature. I had been assuming that the mechanism I proposed was
>>>easier and better extensible for the future.
>>>
>>>
>>Well, this headers are included always first:
>>
>><boost/python.hpp>
>><boost/cstdint.hpp>
>>
>
>Err, they're not here. The first include is always the one the 
>Class() or AllFromHeader() has pulled in, which is invariably not 
>global across all modules.
>

Just generated:

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

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

Both in single and multiple mode. Can you post your generated code where 
the user's headers are included first?

>BTW is AllFromHeader() fixed yet?
>

No. 8(

>>And I guess you could easily create a header, named "mylib.h", that
>>includes everything else. So your pyste files would always just use
>>this header to look for the classes/functions. Notice too that with
>>the new --cache-dir option, GCCXML would be called only once for
>>"mylib.h". With this, I guess using pre-compiled headers would be
>>possible, right?
>>
>
>That causes extra recompiles. If I alter some header higher up, it 
>means I must recompile ALL my modules instead of the one it actually 
>affects. I'd prefer to avoid that please.
>

Ops, you're right. You suggested CommonInclude, but I think PCHInclude 
would be better, what you think? Also, I seem to have missed the point 
of your posted #ifdef...

So, PCHInclude would always include that header first in *all* modules, 
right? Anything else is needed?

Regards,
Nicodemus.





More information about the Cplusplus-sig mailing list