C++ Boost

Boost.Python

Configuration


Introduction
Application Defined Macros
Library Defined Implementation Macros

Introduction

Boost.Python uses several configuration macros in <boost/config.hpp>, as well as configuration macros meant to be supplied by the application. These macros are documented here.

Application Defined Macros

These are the macros that may be defined by an application using Boost.Python. Note that if you extend a strict interpretation of the C++ standard to cover dynamic libraries, using different values of these macros when compiling different libraries (including extension modules and the Boost.Python library itself) is a violation of the ODR. However, we know of no C++ implementations on which this particular violation is detectable or causes any problems.

Macro Default Meaning
BOOST_PYTHON_MAX_ARITY 15 The maximum arity of any function, member function, or constructor to be wrapped, invocation of a Boost.Python function wich is specified as taking arguments x1, x2,...Xn. This includes, in particular, callback mechanisms such as object::operator()(...) or call_method<R>(... ).
BOOST_PYTHON_MAX_BASES 10 The maximum number of template arguments to the bases<...> class template, which is used to specify the bases of a wrapped C++ class..
BOOST_PYTHON_STATIC_MODULE not defined If defined, prevents your module initialization function from being treated as an exported symbol on platforms which support that distinction in-code
BOOST_PYTHON_ENABLE_CDECL not defined If defined, allows functions using the __cdecl calling convention to be wrapped.
BOOST_PYTHON_ENABLE_STDCALL not defined If defined, allows functions using the __stdcall calling convention to be wrapped.
BOOST_PYTHON_ENABLE_FASTCALL not defined If defined, allows functions using the __fastcall calling convention to be wrapped.

Library Defined Implementation Macros

These macros are defined by Boost.Python and are implementation details of interest only to implementors and those porting to new platforms.

Macro Default Meaning
BOOST_PYTHON_TYPE_ID_NAME not defined If defined, this indicates that the type_info comparison across shared library boundaries does not work on this platform. In other words, if shared-lib-1 passes typeid(T) to a function in shared-lib-2 which compares it to typeid(T), that comparison may return false. If this macro is #defined, Boost.Python uses and compares typeid(T).name() instead of using and comparing the std::type_info objects directly.
BOOST_PYTHON_NO_PY_SIGNATURES not defined If defined for a module no pythonic signatures are generated for the docstrings of the module functions, and no python type is associated with any of the converters registered by the module. This also reduces the binary size of the module by about 14% (gcc compiled).
If defined for the boost_python runtime library, the default for the docstring_options.enable_py_signatures() is set to false.
BOOST_PYTHON_SUPPORTS_PY_SIGNATURES defined if BOOST_PYTHON_NO_PY_SIGNATURES is undefined This macro is defined to enable a smooth transition from older Boost.Python versions which do not support pythonic signatures. For example usage see here.
BOOST_PYTHON_PY_SIGNATURES_PROPER_INIT_SELF_TYPE not defined If defined the python type of __init__ method "self" parameters is properly generated, otherwise object is used. It is undefined by default because it increases the binary size of the module by about 14% (gcc compiled).

Revised 7 January, 2003

© Copyright Dave Abrahams 2002.