Next: Embedding Python in Up: Extending Python with Previous: Reference counts

Writing extensions in C++

It is possible to write extension modules in C++. Some restrictions apply: since the main program (the Python interpreter) is compiled and linked by the C compiler, global or static objects with constructors cannot be used. All functions that will be called directly or indirectly (i.e. via function pointers) by the Python interpreter will have to be declared using extern "C"; this applies to all `methods' as well as to the module's initialization function. It is unnecessary to enclose the Python header files in extern "C" {...} - they do this already.


guido@cwi.nl