[Pyrex] [Mac Inter Core Duo OS 10.4.9 ] extern C class decl. requires module specification
David Goldsmith
David.L.Goldsmith at noaa.gov
Thu Jun 14 14:48:06 UTC 2007
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).
Potentially, I don't really have a problem, as the legacy code I'm
wrapping is devoid of classes (this has always astonished me as it had
always been billed as C++ code since starting this job); the potential
problem is that another coder on the project has begun reimplementing
features with C++ libraries, and it's possible that I'm going to have to
interface to those (though reimplementing those w/ equivalent Python
modules is under consideration).
Or perhaps I should just go back to SWIG...
DG
>
> --
> Greg
--
ERD/ORR/NOS/NOAA <http://response.restoration.noaa.gov/emergencyresponse/>
More information about the Pyrex
mailing list