37,743
社区成员




static PyObject *
Extest_hello(PyObject *self, PyObject *args) {
int res;
int id;
PyObject* retval;
//char* data=hello();
retval = (PyObject *)Py_BuildValue("s", "hello");
return retval;
}
static PyMethodDef
ExtestMethods[] =
{"hello", Extest_hello, METH_VARARGS},
{NULL, NULL},
};
void initExtest() {
Py_InitModule("extest", ExtestMethods);
}
#!/usr/bin/python
from ctypes import *
import os
import ctypes
extest = cdll.LoadLibrary(os.getcwd() + '/build/lib.linux-x86_64-2.7/extest.so')
res = extest.hello()
print res