![]() |
|
SitemapMcMillan Enterprises, Inc.Python Pages Sockets HOWTO Distributing Python Programs A Python C++ API SCXX API Embedding Python Stackless Python MkSQL Import Hooks Java Samples About ME Inc. |
SCXX - A Simple Python/C++ APIWhat's New[Jan 25 2002] Classes (PWEngine, FreeThreadedBlock, PythonThreadedBlock) for dealing with Python threas. PWOModule, a simple wrapper for Python module objects. OverviewSCXX (Simplified CXX) is a lightweight C++ wrapper for dealing with PyObjects. It is inspired by Paul Dubois' CXX, but is much simpler. It does not use templates, so almost any compiler should work. It does not try to hide things like the Python method tables, or the init function. It only covers wrapping the most common PyObjects, with a minimum of code bloat. You can write extensions in C++ that can be loaded by a Python compiled and linked with the C compiler. It lets you write C++ that looks a lot more like Python than the C API. Reference counts are handled automatically. It has not been optimized - it generally uses the highest possible level of the Python C API. Using SCXXMost of the SCXX classes can be used to create new Python objects, or wrap existing ones. Wrapping an existing one forces a typecheck (except for PWOBase, which doesn't care). So:
Operators are overloaded so C++ looks as much like Python as possible.
Since errors are normally reported through exceptions, use code like this:
To signal errors in your own code, use:
To return a PWOxxx wrapped (or created) instance to Python, use disOwn():
Note that the PWOxxx classes are generally designed to be created on the stack. The corresponding PyObject is on the heap. When the PWOxxx instance goes out of scope, the PyObject is automatically decreffed (unless you've used disOwn()). See SCXX API for more. InstructionsDownload scxx_b3.tar.gz. Point to the installation directory with a Warning: With certain recent versions of g++, you cannot LicenseNo restrictions on usage, modification or redistribution, as long as the copyright notice is maintained. No warranty whatsoever.
|
copyright 1999-2002 McMillan Enterprises, Inc. |