It has always been an efficient to Python, but the procedures in the hand are developed with C . I don't want to override this part of the data structure, so I thought of using Boost Python to make this part of the data structure into Python expansion pack for easy Python is programmed in the program.
Boost Python's documentation is relatively clear, it is relatively relaxed when writing extensions. Since I first use Boost Python, just write the Enum section in the C program first write the Python extension package. I only encountered a problem, the previous program is not very good, defined a enumeration variable called "None" under Global Namespace, and defines the "None" enumeration variable again in a namespace A, resulting in. Value ("None", None statement is prompted to compile errors. In fact, as long as it is written .value ("none", A :: none) is OK. Another one is boost_python_module (pyobject1) that is the most defined in each file, and finally you output the PYD file to PyObject1.pyd, the case must be the same, otherwise the Dynamic Module Does Not Defein init function will be prompted.
I have encountered some problems when I establish a compilation environment. Three files are required to establish Jamfile, Jamrouls, and Boost-Build.jam. Jamfile is not very special, followed by Example in Boost Python.
Boost-build.jam file is approximately as follows:
Boost_root = "E: / C Library / Boost_1_32_0"; Boost-Build "E: / C library / boost_1_32_0 / Tools / Build / V1"
I have written my own work path, I need to pay attention to "/" instead "/", I guess "//" may also, I haven't tried it.
Jamfile file is approximately as follows:
Path-Global Boost_Root: "E: / C Library / Boost_1_32_0";
Python_version = 2.4; python_root = c: / python24;
Project Test: $ (boost_root);
Here you can make some settings of Python installation information, and finally, you must write, otherwise it will be prompted, and now you don't understand what is used.
When compiled, the include and lib set by vcvars32.bat cannot be used directly by BJAM, you need to modify the MSVC-Tools.jam file under the Boost_Root / Tools / Build / V1 directory, and comment the middle of the following two lines,
Flags MSVC stdhdrs: $ (msvcdir) $ (SLASH) include; Flags MSVC StdlibPath: $ (MSVCDIR) $ (SLASH) LIB;
Then modify the path corresponding to the include and lib, which cannot be used directly, because the string of BJAM will handle an error.