[Pyrex] #if

Michael P. Dubner dubnerm at mindless.com
Sun Oct 19 04:01:54 CEST 2003


Bryan Weingarten wrote:

>the following #if statement didn't appear the generated c code.  is
>there something i'm missing to make this work?
>
>def map_win32(self, err):
>    #if defined(_windows)    
>    return _wgpr._builtins._map_win32(err)
>    #endif
>
>thanks, 
>
>bryan
>  
>
Why your version not working was described in at least two letters.
There is one (yet) unsupported solution for your problem. I've written 
pre-processor for Pyrex.
You can download it here:

http://www.dubnerm.newmail.ru/soft/PyxPP/PyxPP-0.9-1.tar.gz

It's not yet accepted or rejected by Greg (I've sent him a patch but he 
possibly has no time to check it out).
Using it you can rewrite you code as:

def map_win32(self, err):
    #@if defined(_windows)
    return _wgpr._builtins._map_win32(err)
    #@endif

At symbol (@) used to distinguish normal Python comments from 
conditional compilation statements. For more details lookup:
http://www.dubnerm.newmail.ru/soft/PyxPP/

--
Best regards,
Michael Dubner
PS: Sorry for my English







More information about the Pyrex mailing list