我真的很难使用 ctypes 从 python 调用一个简单的 c++ dll
下面是我的 C++ 代码:
#ifdef __cplusplus
extern "C"{
#endif
__declspec(dllexport) char const* greet()
{
return "hello, world";
}
#ifdef __cplusplus
}
#endif
...
我的 Python 代码:
import ctypes
testlib = ctypes.CDLL("CpLib.dll");
print testlib.greet();
当我运行我的 py 脚本时,我得到了这个奇怪的返回值 -97902232
请协助。