我有下面的DLL('arrayprint.DLL')函数,我想通过ctypes在Python中使用它:
__declspec(dllexport) void PrintArray(int* pArray) {
int i;
for(i = 0; i < 5; pArray++, i++) {
printf("%d\n",*pArray);
}
}
我的Python脚本如下:
from ctypes import *
fiveintegers = c_int * 5
x = fiveintegers(2,3,5,7,11)
px = pointer(x)
mydll = CDLL('arrayprint.dll')
mydll.PrintArray(px)
最后的函数调用输出以下内容:
2
3
5
7
11
2226984
2226984是什么?我该怎么处理?它看起来不是DLL、x或px的内存地址的十进制值。
谢谢,
(注意:我实际上并没有使用PrintArray做任何事情;这是我能找到的最简单的例子,它生成了与我正在使用的较长函数相同的行为。)