CXX -- C++ Extensions Support

You don't  make and install CXX in the conventional sense. You'll need to make Python link with C++. To do that, before running configure, set the environment variables LINKCC to 'g++' and LDSHARED to 'g++ -shared' or whatever is appropriate for your C++ compiler.

VPython custom update (February 16, 2003)

If you are using an older compiler, you may need to flip the value of STL_HAS_ITERATOR_TRAITS in Include/CXX_Config.h. This affects some GCC 2.95 builds. We make the assumption that all compilers conform to the ISO standard. If you recieve an error like, "no class template named 'iterator' in 'std'", than you are affected, and must #define STL_HAS_ITERATOR_TRAITS 0. Previously, we attemtped to automatically detect deficient compilers. This detection failed for at least one conforming compiler on the Mac OS X platform, and was removed. This superceeds note(1) for version 3.

Version 4 (February, 2000)

CXX compiles with gcc - 2.95. Includes new version of extension portion by Barry Scott.  I have personally only tested this on RH Linux 6.  Version 4.1 will be released at SourceForge, CXX.sourceforge.net.

Version 3 (June 18, 1999)

1. CXX compiles with EGCS snapshot 19990616. EGCS requires a standard library class random_access_iterator that is not yet available in some other compilers (such as Windows VC6). Therefore a new switch:

STANDARD_LIBRARY_HAS_ITERATOR_TRAITS

has been added to CXX_Config.h that you may need to toggle if you get an error on the two lines that mention random_access_iterator. The current definition is correct for VC6 and EGCS-19990616.

2. A new constructor was added to Module to allow construction from a string containing the module name. A test was added for this to the demo.

Version 2 (Dec. 28, 1998)

Fixed definition of extension type to match 1.5.2. This version will presumably not compile with older versions of Python. This can be fixed by using the previous version's definition. I did not take the time to find out what these new "flags" are for nor put in any methods to deal with them.

Version 1

This is an experimental set of files for supporting the creation of Python extensions in C++.

Documentation is in progress at http://xfiles.llnl.gov.

To use CXX you use the header files in Include, such as CXX_Objects.h or CXX_Extensions.h. You must include the sources in Src in your sources to supply parts of the CXX classes required.

A demo is included. The Setup file in this directory compiles this demo named "example". To try the demo, which is also a test routine, you import example and then execute:

example.test()

You can also play with the extension object whose constructor is named "r":

s = r(1, 100, 2)
print s[2]  # should print 5

Compilation with Microsoft Visual C++ 5.0 will succeed but only if you have Service Pack 3 installed. Compilation has been known to succeed on a Unix system using KCC by using:

setenv CCC "KCC -x"

before running makethis.py.

There is also a python.cxx file for making a stand-alone Python containing this example, as well as a similar file arraytest.cxx for testing Array.

Comments to dubois1@llnl.gov, please.

Paul Dubois