[Pyrex] C-API implementation in Pyrex 0.9.6

Stefan Behnel stefan_ml at behnel.de
Fri Oct 12 12:32:27 CEST 2007


Greg Ewing wrote:
> Stefan Behnel wrote:
> 
>> This is due to missing cimports in the .pyx file that cimports the
>> API, which
>> makes the generated .c file lack some header #includes.
> 
> I'm not sure I follow you there. Using cimport to import
> functions shouldn't involve #includes at all -- Pyrex should
> emit whatever declarations are needed directly into the .c
> file.
> 
> Can you provide a cut-down example which illustrates the
> problem?

I'll see what I can come up with.


>> However, the missing
>> header files are not required for the API, they only touch internally
>> used
>> objects that are not exported through the API but written into the
>> module .h
>> file.
> 
> All type declarations in a .pxd file get written into the
> .h file, because they could potentially be used by functions
> that are part of the API.

I think it's better to let the user decide which types are relevant. Declaring
them "public" would be sufficient, Pyrex shouldn't store types automatically.


> Anything which is truly internal to the module shouldn't be
> declared in the .pxd and shouldn't be declared public, so it
> shouldn't end up in the .h file. If that's happening somehow,
> it sounds like a bug.

As you said, *all* types end up in the module .h file although only some of
them are currently declared public. That's the problem.

Stefan




More information about the Pyrex mailing list