[Pyrex] [Mac Inter Core Duo OS 10.4.9 ] extern C class decl. requires module specification

Lenard Lindstrom len-l at telus.net
Thu Jun 14 16:53:43 UTC 2007


David Goldsmith wrote:
> Greg Ewing wrote:
>   
>> Oh, I see -- you're talking about a C++ class, not
>> a Python class!
>>
>> You should declare this in Pyrex as a struct, not
>> a class. If you use the word 'class', Pyrex thinks
>> you're defining an extension type.
>>
>> Also be aware that Pyrex doesn't really know about
>> C++ classes, and will treat it as though it were
>> a C struct, so you won't be able to do all the things
>> you could do with it in C++.
>>     
> OK, so now I'm going to have to bone up on precisely what features 
> classes support that structs don't (e.g., I used to think that member 
> functions was on that list, then I learned that structs do support that; 
> upon learning that, I just switched to classes, period, and abandoned 
> structs altogether).
>   
C++ structures are classes that make their methods and members public by 
default. Declaring with class is a convention. A while back I wrote a 
guide to using C++ from Pyrex. It was for a pre-Pyrex 0.9.5 patch but 
should still be relevant.

http://lists.copyleft.no/pipermail/pyrex/2006-April/001704.html


-- 
Lenard Lindstrom
<len-l at telus.net>




More information about the Pyrex mailing list