【发布时间】:2016-09-26 13:47:09
【问题描述】:
使用 ctypes "windll.LoadLibrary" 将设备的 DLL 导入 Python 首先,我想使用 DLL 的一个功能,即返回库版本。 有一个带有 DLL 的头文件,其中函数定义如下:
/** * \brief Returns the library version in the format 'AA.BB.CC.DD'
(e.g. '1.0.0.0'). * * OUTPUT PARAMETER * \param version
Version number of the library */
#ifdef __cplusplus extern "C"
#endif
C3_DLL_API void JC_GetDllVersion(char *version);
我用print (str(c3dll.JC_GetDllVersion),"\n")调用了这个函数
但是当我运行脚本时,我只得到这个输出:
('<_funcptr object at>', '\n')
我在这里做错了什么?
【问题讨论】:
-
打印只是返回了引用指针,而不是
print (str(c3dll.JC_GetDllVersion),"\n"),尝试做c3dll.JC_GetDllVersion(),我不确定因为它也需要一个参数。 -
不幸的是,它根本不会产生任何输出。
-
需要打印,
print (c3dll.JC_GetDllVersion()). -
Ups,我忘记了函数名后面的连字符,但现在它只返回:(0, '\n')
-
还有其他想法,为什么这行不通?