Previous Page Up One Level Next Page Extending and Embedding the Python Interpreter Contents
Previous: 1.10.4 NULL Pointers Up: 1. Extending Python with Next: 1.12 Providing a C


1.11 Writing Extensions in C++

It is possible to write extension modules in C++. Some restrictions apply. If the main program (the Python interpreter) is compiled and linked by the C compiler, global or static objects with constructors cannot be used. This is not a problem if the main program is linked by the C++ compiler. Functions that will be called by the Python interpreter (in particular, module initalization functions) have to be declared using extern "C". It is unnecessary to enclose the Python header files in extern "C" {...} -- they use this form already if the symbol "__cplusplus" is defined (all recent C++ compilers define this symbol).


Previous Page Up One Level Next Page Extending and Embedding the Python Interpreter Contents
Previous: 1.10.4 NULL Pointers Up: 1. Extending Python with Next: 1.12 Providing a C
Release 2.2.3, documentation updated on 30 May 2003.
See About this document... for information on suggesting changes.

AltStyle によって変換されたページ (->オリジナル) /