比如有这么c函数
int test (char id[15],char *s,char v[32])
函数返回int结果, 但是函数处理结果存储在数组v中
在python中加载了这个模块, 然后调用这个函数, 但我要取得处理结果, 怎么弄呢?
int test (char id[15],char *s,char v[32])
函数返回int结果, 但是函数处理结果存储在数组v中
在python中加载了这个模块, 然后调用这个函数, 但我要取得处理结果, 怎么弄呢?
1
pimin Oct 23, 2014
test函数是你写的么?
|
2
iptux Oct 23, 2014
```python
import ctypes so = ctypes.CDLL('libtest.so') so.test.restype = ctypes.c_int so.test.argtypes = (ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p) print so.test('arg1', 'arg2', 'arg3') ``` |
3
ruoyu0088 Oct 23, 2014 |