ANN: Lightweight C++ interface classes

Gordon McMillan gmcm at hypernet.com
Sun Aug 8 11:54:35 EDT 1999


SCXX is a very lightweight set of C++ classes that wrap the most 
commonly used Python objects.

It is inspired by Paul Dubois's CXX (part of the LLNL download), but 
does not use templates or STL, (it does use exceptions) and only 
covers a subset of CXX's capabilities. (And this is why I wrote SCXX 
- templates / STL don't work or bloat on many compilers; and I wanted 
something very lightweight.)

Like CXX, the primary advantage is that you can write C++ code that 
looks a whole lot like Python. Reference counts are taken care of; 
wrapping an existing object forces a typecheck; you can use square 
brackets to access sequences and dicts, just like you'd expect...

SCXX uses the highest possible level of the Python / C API at all 
times. While this is slow (refcounting has not been optimized), it is 
very small, and most of it will be inlined on most compilers.

SCXX lives on my starship pages
(starship.python.net/crew/gmcm/scxx.html). It is used by the new
MetaKit wrap that Jean-Claude just announced. (The backlink to
MkWrap is broken, I'll fix this when my ISP's DNS servers come
back).

SCXX has been tested on Windows (MSVC 5) and Linux (egcs) by me, and
on MSVC 6 and newer releases of egcs by Jean-Claude.

[RH 5.2's distribution of egcs (egcs2.90.29 - egcs-1.0.3) is broken 
when it comes to exceptions (catch doesn't). This is fixable by 
downloading the sources and rebuilding.]

The license is "do as thou wilt", but please maintain the copyright 
notices; and no warranty, of course.

- Gordon




More information about the Python-list mailing list