我必须使用不同的 dll 导出此函数(每个 dll 一个函数):
dll1:
DECLDIR void getFrameworkVersion(int* pMajor, int* pMinor, int* pBugfix);
dll2:
void __stdcall getFrameworkVersion(int* pMajor, int* pMinor, int* pBugfix);
我在python中导入两个dll都没有错误,并且调用它们也没有错误。但是我得到了错误的值
dll1 = cdll.LoadLibrary('dll1')
dll2 = oledll.LoadLibrary('dll2')
pMajor = pMinor = pbugFix = c_int()
dll1.getASTFrameworkVersion.argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)]
#test.eval.restype = ctypes.c_double
dll1.getASTFrameworkVersion(byref(pMajor), byref(pMinor), byref(pbugFix))
astVersion = "AST Framework version: " + str(pMinor.value) + "." + str(pbugFix.value) + "." + str(pMajor.value)
dll2.getFrameworkVersion.argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)]
dll2.getFrameworkVersion(byref(pMajor), byref(pMinor), byref(pbugFix))
asfVersion = "ASF Framework version: " + str(pMinor.value) + "." + str(pbugFix.value) + "." + str(pMajor.value)
我得到这个输出:
AST Framework version: 0.0.0
ASF Framework version: 14.14.14