从出口的.so C函数返回我有一个liba.so
包含函数say_hi()
,检索`字符*`从Python中
char *say_hi()
{
return "hello, world";
}
在Python中,我通过访问liba.so
,
>>>liba = ctypes.CDLL("./liba.so")
>>>liba.say_hi()
16422018
如何检索Python中liba.say_hi()
返回的字符串"hello, world"
?
PS
此外restype
,任何其他方式?
http://docs.python.org/library/ctypes.html#return-types – Matthias 2012-02-24 08:19:19