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

Robert Bradshaw robertwb at math.washington.edu
Fri Jun 15 01:47:16 UTC 2007


On Jun 14, 2007, at 7:48 AM, 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).

You can declare the struct to contain function pointers, and then  
call them directly.





More information about the Pyrex mailing list