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
よろしくお願いします。