无法在Python中加载C DLL
could not load c++ DLL in python
我试图在Python中使用C .dll
,但我什至无法加载它。我正在尝试以下Python代码加载:
from ctypes import cdll
mydll = cdll.LoadLibrary('SORT_DLL.dll')
但是当我尝试运行这个时,我会得到:
D:...srcSORT_DLLDebug>UseDll.py
Traceback (most recent call last):
File "D:...srcSORT_DLLDebugUseDll.py", line 2, in
<module>
mydll = cdll.LoadLibrary('SORT_DLL.dll')
File "C:Python27libctypes__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "C:Python27libctypes__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 ist keine zulõssige Win32-Anwendung
最后一句话是指英文中的"%1不是有效的win32应用程序"。
我已经在http://docs.python.org/2/library/ctypes.html#module-ctype上查找了它,但这并没有导致解决我的问题的解决方案。
听起来您已经安装了Python的不兼容版本,或使用错误的设置编译了DLL。DLL和Python解释器都必须为32或64位。
请参阅此答案:https://stackoverflow.com/a/10163943/953887
" ctypes不适用于c ,[dll]示例写在其中。"
相关文章:
- Python ctypes:不会按预期加载 dll
- 在 Linux 平台的 C++ 中动态加载 DLL
- 为什么 LoadLibrary 失败,而 LoadLibraryA 成功加载 DLL?
- 为什么有些延迟加载 DLL 会立即使用 FFMPEG 卸载?
- 了解加载库无法加载 DLL 的原因
- 应用程序仅在qt调试器中加载dll,而不是独立加载
- dll 生成成功,但在加载 dll 时执行错误
- QT 加载.dll不调用解析
- 通过重新加载DLL,避免使用DLL预加载漏洞,任何更好的方法
- 问题在具有依赖性时从其他路径上加载DLL的DLL
- C++插件不能延迟加载dll时
- Java加载DLL,该DLL从JNI中的另一个DLL导出方法
- C++ 动态加载 DLL 错误
- GHCi 无法在 Windows 上加载.dll lib(C++ lib)
- 使用C++应用程序加载 DLL
- System.DllNotFoundException:无法使用 dotnet core 加载 DLL
- 当应用程序在不同系统上运行时,无法加载DLL异常
- 如何停止二级IMPLICITLY加载DLL的DLL劫持
- 无法加载dll libglorycolx2010.dll.该应用程序未能启动,因为其并排配置不正确.Hresult:0x
- 如何在Acrobat JavaScript中加载DLL文件