[Pyrex] #if
Bryan Weingarten
bryan.weingarten at pobox.com
Sun Oct 19 06:11:17 CEST 2003
Michael P. Dubner wrote:
> 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
>
>
>
>
this looks great. i have one question that i couldn't figure out from
the documentation. in this example
cdef extern from "spam.h":
void *spam_init(int argc, char* argv[])
* #@if HostOS=="nt"*
void spam_as_nt_service(void *spam)
* #@elif HostOS=="posix"*
void spam_use_fork(void *spam, int flag)
* #@endif*
spam_finish(void *spam)
is HostOS defined in spam.h?
bryan
More information about the Pyrex
mailing list