Python加载DLL有错误 - WindowsError:[错误4250]

时间:2017-12-21 05:43:26

标签: python ctypes dllimport

我发送了一个dll文件以及头文件和.lib文件,它们是用C编译的。但是当我尝试使用ctypes使用python加载dll文件时,我收到一条错误,上面写着“self._handle” = _dlopen(self._name,mode) WindowsError:[错误4250]“。 我把发送给我的文件放在python src目录中,我还用visual studio的dumpbin命令查看了.dll文件的依赖项,并说它

File Type: DLL

Image has the following dependencies:

VCRUNTIME140D_APP.dll
ucrtbased.dll
api-ms-win-core-debug-l1-1-1.dll
api-ms-win-core-errorhandling-l1-1-1.dll
api-ms-win-core-string-l1-1-0.dll
api-ms-win-core-heap-l1-2-0.dll
api-ms-win-core-memory-l1-1-2.dll
api-ms-win-core-libraryloader-l1-2-0.dll
api-ms-win-core-profile-l1-1-0.dll
api-ms-win-core-processthreads-l1-1-2.dll
api-ms-win-core-sysinfo-l1-2-1.dll
api-ms-win-core-interlocked-l1-2-0.dll
api-ms-win-core-winrt-l1-1-0.dll

Summary

    1000 .00cfg
    1000 .data
    1000 .idata
    3000 .rdata
    1000 .reloc
    8000 .text
   10000 .textbss

我在python中使用的代码是

import ctypes
from ctypes import *
testclib =ctypes.CDLL("Impo.dll")

我是否必须在python中链接头文件和其他文件?如果是这样,我该怎么做呢?或者dll文件本身有什么问题吗?

0 个答案:

没有答案