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

Lenard Lindstrom len-l at telus.net
Fri Jun 15 06:39:46 UTC 2007


David Goldsmith wrote:
> Lenard Lindstrom wrote:
>   
>> David Goldsmith wrote:
>>   
>>     
>>>
>>> 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. 
>>     
> Is that all?  No issues of inheritance?  Polymorphism?  Etc.?
>   

That's all. See bottom of 
http://www.cplusplus.com/doc/tutorial/classes.html  . Actually a C 
structure in C++ is just a minimal class: everything public, no methods, 
no base class.

>> 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
>>   
>>     
> Great, thanks!!!
>   

Your welcome. Note that C++ classes declared in the header use the 
"class" declaration. Luckily C++ method calls use the same semantics as 
function pointer calls on C structure fields. This lets one describe a 
C++ class as a struct type in Pyrex.

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




More information about the Pyrex mailing list