IfProgramDirectly use the python module exported by this program, you do not need to export it to the PYD library.
For example, if program A has its Python extension module named exta, after calling the initialization function initexta () of the exta module in program, you can directly use the exta module method in the program. As follows:Code:
# Include <python. h> # include <boost/python. HPP> using namespace boost: Python; void testpy () {printf ("Hello world \ n") ;}// generate the export module boost_python_module (exta) {def ("testpy", testpy);} int _ tmain (INT argc, _ tchar * argv []) {py_initialize (); initexta (); pyrun_simplestring ("Import exta"); // use the exta module pyrun_simplestring ("exta. testpy () "); py_finalize (); System (" pause "); Return 0 ;}
This method saves the need for additional dynamic Connection Library export projects. If you do not want your program to be attached with too many dynamic connection libraries, this section is a very convenient method.
Sometimes function declaration is used to facilitate use in other program modules. Therefore, the void initxxx () Declaration must be put into the header file. Note: The initxxx function in the boost: Python library is prototype: extern "C" _ declspec (dllexport) void initxxx ();