[Pyrex] Pyrex and C++

David J. C. Beach beach at verinet.com
Sat Nov 15 06:51:40 CET 2003


I just joined the pyrex list, but having searched through the archives,
it seems there has been some previous discussion on the topic of making
Pyrex work with C++.  Regurgitating what I read previously, the
suggested strategy was:

1) Make the output of pyrexc compile cleanly with a C++ compiler
2) Add command line support for "C++" friendly output (e.g. name the
output file with ".cpp", wrap the file in extern "C" { }, etc.)
3) Add some rudimentary support for C++ method call syntax
4) Whatever comes next....

I was looking at the work involved in attacking item #1.  I'm not very
familiar with the pyrex code base yet, but from running my own tests, it
seems that there are three categories of error that cause the C++
compiler to complain about the pyrexc produced code:

1) Assignment to "non l-values"
2) Redeclaration of variables
3) Assigning to non-void pointers from void* values

I don't yet fully understand the details of #1, but I believe that #2
and #3 are easily fixed.  For #2, either the redundant declarations need
to be omitted, or all but one should include the "extern" keyword.  For
#3, the appropriate casting operator must be employed.  (My testing is
not extensive; are there any other cases I have missed?)

I think Pyrex is a great project, and I'd love to see it support C++. 
Is there any way I can help by working on these difficulties?  Should I
just start digging my way through the Pyrex codebase?  Is there a
development version I should be working from (instead of the 0.9 release
source code?)

Thanks for any help.

Dave 

-- 
David J. C. Beach
<beach at verinet.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20031115/d3a4c8d7/attachment.bin


More information about the Pyrex mailing list