Re: [capi-sig] The same Python DLL loaded twice
On 07.10.2013 14:31, Mateusz Loskot wrote:
Hi,
I'm experiencing strange issue with the very same python32.dll being loaded twice on Windows.
I have an application which embeds Python. Launching my app loads python32.dll for the first time and all seems working well. Next, under the embedded Python, I execute this one-liner "import tkinter"
This triggers loading of _tkinter.pyd, tk85.dll, tcl85.dll as well as python32.dll for the second time.
The duplicate python32.dll is loaded into different address space, maintains its own thread state, leading to crash from PyInit__tkinter, obviously.
The problem seems to be similar to this one http://stackoverflow.com/questions/2147729/dll-file-loaded-twice-with-dll-re...
Has anyone experience similar issues? Any ideas on possible reasons of duplicate loading of python32.dll?
Could you check the version numbers of those two DLLs.
It's possible that you're loading a Python DLL for say 3.2.1 and one for 3.2.2.
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, Oct 07 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
2013-10-14: PyCon DE 2013, Cologne, Germany ... 7 days to go
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
On 7 October 2013 13:38, M.-A. Lemburg <mal@egenix.com> wrote:
On 07.10.2013 14:31, Mateusz Loskot wrote:
Hi,
I'm experiencing strange issue with the very same python32.dll being loaded twice on Windows.
I have an application which embeds Python. Launching my app loads python32.dll for the first time and all seems working well. Next, under the embedded Python, I execute this one-liner "import tkinter"
This triggers loading of _tkinter.pyd, tk85.dll, tcl85.dll as well as python32.dll for the second time.
The duplicate python32.dll is loaded into different address space, maintains its own thread state, leading to crash from PyInit__tkinter, obviously.
The problem seems to be similar to this one http://stackoverflow.com/questions/2147729/dll-file-loaded-twice-with-dll-re...
Has anyone experience similar issues? Any ideas on possible reasons of duplicate loading of python32.dll?
Could you check the version numbers of those two DLLs.
It's possible that you're loading a Python DLL for say 3.2.1 and one for 3.2.2.
Yes, I have checked that file name, file path and version of the Python DLL which is loaded twice are all the same. The two loadings refer to the very same file.
I eventually found where is the problem. The application which embeds Python is linked with Python DLL and it refers to Python assembly using custom manifest specified wit
#pragma comment(linker, "\"/manifestdependency:name='Python' ... )
But, _tkinter.pyd does not load Python through the manifest. So, the application and the _tkinter.pyd link to Python DLL as they would be two distinct assemblies.
If I remove the /manifestdependency directive from my application, rebuild it and ensure Python DLL is present in DLL search path, then no double loading occurs and all works well.
The side-by-side technology is a bit slippery :)
Best regards,
Mateusz Loskot, http://mateusz.loskot.net
participants (2)
-
M.-A. Lemburg
-
Mateusz Loskot