C++ Boost

Boost.Python

Configuration

Ťփ


Introduction
Application Defined Macros
Library Defined Implementation Macros
ܼ/a>
ӦӃ樒嵄ꪼ/a>
蒥儊取ꪼ/a>

Introduction

ܼ/h2>

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.

Boost.PythonʹӃK<boost/config.hpp> 儼踶Ťփꪣ썊 ͬʱ빻ᓐӦӃ̡駔ą䖃ꪡ㍊ 䋴抇բꪵċ僷΄嵡㼯p>

Application Defined Macros

ӦӃ樒嵄ꪼ/h2>

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.

բʇԓɊ鈴Boost.Python儓擃樒嵄ꪡ㍊ עҢ㬈繻豽⊍C++᪗죬ʹ֮ༀ趯̬썊 ćo넜Ӄ⻍쵄ꪖ屠ҫ⻍쵄썊 㨰쀨)չģ喙ͼb>Boost.Python㩣썊 籔⾍ʇ捍a href="definitions.html#ODR">ODR載巴ᣍ Ȼ渣쎒CuӐԚȎꎃ++ʵϖ֐쬲⵽բ֖̘ʢ載啥㬻⒲䋔쳉Ȏꎎʌ⡣

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>(... ).

佷◰儈Β뺯ʽᢳɔắʽ벹錟ꯊ׮䳼a href= "definitions.html#arity">Ԫʽ㬍 촼b>Boost.Pythonꯊʜ儲Ί퍊 x1, x2,...Xnᣍ ̘ᰰ쀨똵綹ֆ㬀툧object::operator()(...) 벼code>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..

bases<...> ģॵėģॲΊʽ㬍 脹ģ॓A䖸÷ỷ◰儃++ 儻造ᣍ
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

ȧ黆패֧㖓oꂫǸ疵쳶綹ţ썊 樒勼Է鄣侀劼믺ỵᗷһ趵쳶綹š㍊

Library Defined Implementation Macros

蒥儊取ꪼ/h2>

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

բꪓɼb>Boost.Python樒嵄㬊NJ取ɏ粲轚㬍 ֻӐĊ取՟㬒Լćֲ҆퐂ƽ̨儈˶Դ˸ˈ䡣

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.

ȧ黓蒥㬍 ˵÷膽패ɏ⻿ɒԿ甽鲏儱߽籈폴ype_infoᣍ 뻾仰˵ǣ숧黹⏭ϲ鲏2儺䫵ݍ typeid(T)㬲⓫儼code>typeid(T)ሽϣ썊 뿉Ĝʇfalseᣍ ȧ黣define胺꣬Boost.Python롊鈴typeid(T).name() Ƚϣ춸⻊ǖὓʹӃꍱȽϼcode>std::type_info攏㡣
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.

ȧ黃㿩Ӑ樒壬Բ胄㿩ꯊ΄歲ַ봮֐뻡⺉ꐹthon儇郻ʽ㬍 胄㿩ע⡵ĈκΗ껻Ʒ漲뻡閣ꐹthon Ѝᣍ բҲ롼吡澽薆ģ冀Ĵ㐡㬔챴%㨧cc᠒룩᣼br> ȧ黢oost_pythonԋʱ蒥㬍 docstring_options.enable_py_signatures() 億숏ֵ롉莪false
BOOST_PYTHON_SUPPORTS_PY_SIGNATURES defined if BOOST_PYTHON_NO_PY_SIGNATURES is undefined

ȧ黼code>BOOST_PYTHON_NO_PY_SIGNATURESδ樒唲樒布ꪍ
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汾⻖糖Pythonǩu㬶蒥胺꣬ԴӾɰ汾ƽΈ齶ɡ㍊ ʹӃ儀헓컼a href="pytype_function.html#examples">բ/ᣍ
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).

ȧ黓蒥㬾ͻᕽȷɺ㉐ython __init__罷資ᰳelfᱲΊ Ѝ㬷ᔲ㬾͊鈴objectᣄ숏ʇδ樒壬ҲΪ˼Զ쓁˄㿩攜ֆ䳐ᣬԼ14%㨧cc᠒룩ᣍ

Revised 7 January, 2003

© Copyright Dave Abrahams 2002.

筒룺켯a>

ҫ΄輐£결08.6.15