update binding

This commit is contained in:
virusdefender 2017-11-29 14:32:06 +08:00 committed by virusdefender
parent f9a6db3287
commit d7c8e51e1d
2 changed files with 4 additions and 9 deletions

View File

@ -99,14 +99,7 @@ static PyObject *judger_run(PyObject *self, PyObject *args, PyObject *kwargs) {
}
}
void *handler = dlopen("/usr/lib/judger/libjudger.so", RTLD_LAZY);
void (*judger_run)(struct config *, struct result *);
if (!handler) {
RaiseValueError("dlopen error")
}
judger_run = dlsym(handler, "run");
judger_run(&_config, &_result);
run(&_config, &_result);
return Py_BuildValue("{s:i, s:l, s:i, s:i, s:i, s:i, s:i}",
"cpu_time", _result.cpu_time,

View File

@ -4,4 +4,6 @@ from distutils.core import setup, Extension
setup(name='_judger',
version='2.1',
ext_modules=[Extension('_judger', sources=['_judger.c'], libraries=["dl"])])
ext_modules=[Extension('_judger',
sources=['_judger.c'],
extra_link_args=["-L", "/usr/lib/judger", "-l", "judger", "-Wl,-rpath=/usr/lib/judger"])])