[Pyrex] Please support C++
Lenard Lindstrom
len-l at telus.net
Wed Oct 12 23:07:14 CEST 2005
On 11 Oct 2005 at 19:41, Greg Ewing wrote:
> David McNab wrote:
>
> > So Greg, sorry I'm not in a strong position at this time to contribute;
>
> I understand completely. I have trouble keeping the
> whole thing straight in my own head, and I wrote the
> darn thing!
>
> > maybe there's room for a 'pyrex internals hacking manual' or other kind
> > of internals walkthrough doc.
>
> That's not a bad idea. If I ever stop hacking in new
> features for long enough, I might have a go at writing
> something along those lines.
>
> In the meantime, the comments at the top of Nodes.py
> and ExprNodes.py may provide a bit of guidance to anyone
> intrepid enough to tackle the guts.
>
I've made a few changes to the Pyrex-0.9.3.1 compiler so it now produces C code
that also compiles as C++ for some Pyrex programs. I have removed the remaining
staticforwards and added the necessary conditionally compiled extern "C"s. The
changes are restricted to Nodes.py.
In making the changes I assumed the staticforward declarations of extension types
are unnecessary. I found no place in the compiler where a PyTypeObject variable is
refered to before it is declared. Outside of the module init function all access to an
extension type appears to be through a pointer. But I would like this confirmed
before going any further.
The changes do not allow all Pyrex programs to compile as C++. The one problem I
know of involves extension type C methods. Pyrex uses (void *) casts to filling the
vtable for an extension type. A C++ compiler simply rejects them. Removing these
casts will not be simple.
Finally, how is the best way to make the patch available for general testing? At 7.5K
is it too large to be an e-mail attachment?
Lenard Lindstrom
<len-l at telus.net>
More information about the Pyrex
mailing list