From d7c8e51e1d1a6c38df4563b76fe10d0d777faf3d Mon Sep 17 00:00:00 2001 From: virusdefender Date: Wed, 29 Nov 2017 14:32:06 +0800 Subject: [PATCH] update binding --- bindings/Python/_judger.c | 9 +-------- bindings/Python/setup.py | 4 +++- 2 files changed, 4 insertions(+), 9 deletions(-) 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"])])