ANN: Pyrex 0.3.4

Robin Becker robin at jessikat.fsnet.co.uk
Fri Jul 19 04:55:01 EDT 2002


In article <afe3b146.0207172203.1cca6d73 at posting.google.com>, Brian
Lenihan <brian_l at yahoo.com> writes
>Robin Becker <robin at jessikat.fsnet.co.uk> wrote in message 
>news:<BLhRFIAGTfN9Ew1
>y at jessikat.fsnet.co.uk>...
......
>>         primes.c(139) : see declaration of 'initprimes'
>> error: command '"C:\Program Files\Microsoft Visual
>> Studio\VC98\BIN\cl.exe"' failed with exit status 2
>
>It's not you. MSVC doesn't like the void initprimes
>prototype above the
>
>__declspec(dllexport)
>void initprimes(void) {
>
>You can work around it by inverting the order in
>Pyrex/Compiler/Nodes.py like so: 
>
>header = "void init%s(void)" % env.module_name
>if sys.platform == "win32":
>    code.putln("__declspec(dllexport)")
>else:
>    code.putln("%s; /*proto*/" % header)
thanks for the info, but this code looks pretty weird to me.

Why do we need the prototype immediately before the actual
specification?

in the non win32 output 

void initprimes(void); /*proto*/
void initprimes(void){
        .......
        }

the first line seems completely redundant.

any how I tried /F's suggestion and replaced all that with

        code.put_var_declarations(env.const_entries, static = 1)
        code.putln("")

        code.putln("DL_EXPORT(void) init%s(void){" % env.module_name)

        code.put_var_declarations(env.temp_entries)
-- 
Robin Becker



More information about the Python-list mailing list