C ++ Boost Python (generated an extension module)

zhaozj2021-02-08  212

Generate an extension module

Boost's build process, I want to have some evolution and improvement, and some of the facts may be helpful:

Subdistribution in Boost

Libs / Python / Build has a Make file on a variety of platforms and a Visual Studio project. Build's goals include:

The Boost_Python static connection library used by the expansion module. The files on the library on various UNIX platforms are libboost_python.a. When you use Visual C , the library file is a comprehensive test case of boost_python.lib. Boost.Python library. This test uses the first to build a Boost.Python extension module, then run Python to import this module, then use the DOCTEST to make a series of tests on the library. Module and test case source code Libs / Python / Test under the Boost It can be found. Various examples of Boost subdirectories Libs / Python / Example. In these examples contains DOCTEST based on the full test case described above.

Boost contains a set of

The Boost_Python library compiles a static connection version of the Make file (these make files support at the same time compile, support stable sets of features), a comprehensive test case Make file, and

All examples of all examples in libs / python / example directory.

Vc60.mak: Visual C 6.0 Service Pack 4 MINGW32.MAK: MINGW32 (WIN32 version) GCC 2.95.2 Linux_gcc.mak: Linux / Unix GCC 2.95.2 Tru64_cxx.mak: Compaq CXX compiler IRIX_CC on Compaq alpha machine. MAK: Silicon Graphics Irix 6.5 CC Compiler

The method of use of these Make files here

There are also another set of Make files specifically prepared for GNU Make. These Make files are much more concise than those of the Make files above, but it is not so complete, and does not support simultaneous compilation on a variety of platforms.

Como.mak: Comeau C GCC.mak on Linux: Linux / Unix GCC

Boost provides an engineering file for Microsoft Visual Studio:

Libs / Python / Build / Build.dsw. This project's incrude path may need to do some changes according to your installation. Project hypothesis Python is installed

C: / Tools / Python. This project provides three configuration options for all goals:

Release (Optimization, -Dndebug) DebugPython (unopened, -d_debug -dboost_debug_python)

When using the -d_debug option in Visual C . Python enforces a special debug version DLL connection by default. Because Python's Windows version default installation does not provide this debug version of the DLL, so Boost.Python is in Python. H Using Boost / Python / Detail / Wrap_Python.hpp during the Cancel_Debug in the arrival of the Cancel_debug.

If you want to use the additional runtime check feature of the debug version of the library, you can join: #define boost_debug_python to react, and the debug version of Boost_Python.lib. You must get the Python debug version of the executable ( Python_d.exe) and DLL (python20_d.dll or python15_d.dll). Python's source program contains item files to construct these things. If you are the downloaded source, change the name of the uppermost directory to SRC, then put it Install under C: / Tools / Python, so that the project files provided by Boost.Python do not have to change. Just open C: /Tools/python/src/pcbuild/pcbuild.dsw, execute "build all" can be generated Debug version. If you don't define #define boost_debug_python, confirm that all source files use #include instead of usual python.h, otherwise you will touch the connection problem.

If the platform you use is not supported, you can use the following source file to generate a static version of the library (in the Boost subdirectory)

Libs / Python / SRC), or directly to connect the target file and your extended module:

Classes.cpp convers.cpp cross_module.cpp extension_class.cpp functions.cpp init_function.cpp module_builder.cpp ibjects.cpp types.cpp

NEXT:

Package enumeration previous:

Insider's UP:

TOP

© David Abrahams 2001 All rights reserved. This document allows copy, use, modification, sale, and distribution, premise this copyright statement must appear on all copies. The provision of this document does not assume any direct or implicit guarantees, and does not make the statement that is suitable for any purpose.

Update Date: April 17, 2001 (R.W. Grosse-Kunstleve)

转载请注明原文地址:https://www.9cbs.com/read-2322.html

New Post(0)