[英]Windows Error 1114 while loading dll in Python
I am currently trying to port some code from a 32 bit windows XP computer to a 64 bit windows 10 computer.我目前正在尝试将一些代码从 32 位 Windows XP 计算机移植到 64 位 Windows 10 计算机。 I need in my python code to import home developed C dlls as follow :我需要在我的 python 代码中导入家庭开发的 C dll,如下所示:
from ctypes import *
[...]
self.inter_test_dll = windll.LoadLibrary("my.dll")
self.w = QtWidgets.QWidget()
self.wid = self.w.winId()
self.wid.setsize(64)
print(self.wid)
self.inter_test_dll.dll_load_window(int(self.wid), 'test')
self.inter_test_dll.dll_connect(2, self.callback)
[...]
The program crashes as soon as the dll is loaded with a cryptic一旦 dll 加载了一个神秘的程序,程序就会崩溃
Windows Error 1114
Which means a dll crashed on initialization.这意味着 dll 在初始化时崩溃了。 I have tried my dll on my personal machine (64 bits Windows 7), no issue, it all works fine.我已经在我的个人机器(64 位 Windows 7)上尝试过我的 dll,没问题,一切正常。 I have tried that dll on the same 64 bits Windows 10 machine from within a C program, LoadLibrary("my.dll") also fails but LoadLibraryEx("my.dll",NULL, DONT_RESOLVE_DLL_REFERENCE ) does work.我已经在 C 程序中的同一台 64 位 Windows 10 机器上尝试了该 dll,LoadLibrary("my.dll") 也失败了,但 LoadLibraryEx("my.dll",NULL, DONT_RESOLVE_DLL_REFERENCE) 确实有效。
When I run a dependency walker on my dll, it seems to miss some 2 to 4 depth level dll, but it weirdly doesn't seem to affect its working when called properly from within the C program.当我在我的 dll 上运行依赖项walker时,它似乎错过了一些 2 到 4 个深度级别的 dll,但奇怪的是,当从 C 程序中正确调用时,它似乎并没有影响它的工作。
So my question is, is there a way to instantiate my dll within Python without an in-depth check of its dependencies ?所以我的问题是,有没有办法在 Python 中实例化我的 dll 而无需深入检查其依赖项? If not, is there a way to modify my windows behavior, in order to skip that check by default ?如果没有,有没有办法修改我的 Windows 行为,以便默认跳过该检查?
Thanks a lot !非常感谢 !
Thanks for the comments, I have resolved my issue.感谢您的评论,我已经解决了我的问题。
WxWidgets has been updated 2 days ago. WxWidgets 已于 2 天前更新。 I have recompiled my dll with this new version and the bug is gone.我已经用这个新版本重新编译了我的 dll 并且错误消失了。
Sorry I couldn't find a more general approach to the problem.抱歉,我找不到更通用的方法来解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.