diff --git a/bindings/Python/_judger.c b/bindings/Python/_judger.c index 2837b6f..10a3131 100644 --- a/bindings/Python/_judger.c +++ b/bindings/Python/_judger.c @@ -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, diff --git a/bindings/Python/setup.py b/bindings/Python/setup.py index a4036f1..b1ddfc4 100644 --- a/bindings/Python/setup.py +++ b/bindings/Python/setup.py @@ -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"])])