There is a task in front of me: there is some python script, it needs to be used in a DLL, while minimizing the number of output files (preferably up to one dll).

So, the python script itself is loaded into project resources and executed using the Python / C API. The next step, I would like to integrate the python interpreter into my dll.

For this:

  • Download the source code ("Solution") Python 2.7.11 from the official site
  • One project is chosen for compilation - pythoncore
  • Configuration type changed from DLL (dynamic link library) to LIB (static library)
  • The resulting LIB file is added according to my project.

As far as I know, when compiling my project, the statically linked libraries should export their code to the link library. Accordingly, this LIB file (~ 15Mb!) Is completely self-contained (as I understand it).

But when I compile my project, I get errors:

Error 3 error LNK2019: link to unresolved external symbol __imp__Py_Initialize in the _main E: \ 7zip \ myprogtamm \ myprogtamm \ main.obj function

The declaration and source code of this function is present in the project - pythoncore.
What could be the reason?

  • There are 2 clarifications - is the path to the resulting .lib file specified? do .lib and your project have the same bit depth (x86 / x64)? - Yuriy Orlov
  • Yes, the project sees a .lib file. Both projects have a Win32 solution platform. - Alex Teos

0