I've been busy porting a Linux code to Windows, and originally decided to go
for the mingw-w64 toolchain set, with gcc-4.8 and win32 threading model.
I'm embedding Python in C++ code, and I need to be able to import specific
modules, like PySide, to eventually embed an IPython qtconsole in a C++ Qt
window. This all works under Linux, so the approach is sound. And everything
compiled properly under Windows too. PySide was installed via pip.
Now, from a normal Python/IPython console on the Windows system, I can import
what I want:
import PySide.QtCore
No problem here, as expected. But when on the embed side I do:
PyRun_SimpleString("import PySide.QtCore");
I get the following error:
Traceback (most recent call last):
File "<string>", line 2, in <module>
ImportError: DLL load failed: The specified procedure could not be found.
When I import:
PyRun_SimpleString("import PySide");
It works, but I get an empty PySide object. If I import "sys", "os", or
"math", all the modules work as expected though, which is probably due to the
fact that they are compiled in python27.dll.
So I'm a bit puzzled as to what is happening. Why can I start a Python embedded
interpreter, load the builtin modules but not external modules? (I tried other
modules like matplotlib / numpy, which didn't work either).
I very strongly suspect the problem to be a linking error, as python27.dll is
linked to msvcr90.dll, and mingw-w64 links to msvcrt.dll, meaning my library
will be linked to the wrong dll. But in that case, why am I able to load and
run Python nonetheless?
Thanks for the help!
--
https://mail.python.org/mailman/listinfo/python-list