diff --git a/src/binding.cc b/src/binding.cc index cae0aab..cc88a2d 100644 --- a/src/binding.cc +++ b/src/binding.cc @@ -2,6 +2,8 @@ #include #include +#include + #include "py_object_wrapper.h" #include "utils.h" @@ -28,9 +30,21 @@ Handle import(const Arguments& args) { void init (Handle exports) { + + // simple hack to avoid errors when loading numpy .so + { + void* handle = dlopen("libpython2.7.so", RTLD_LAZY | RTLD_GLOBAL); + dlclose(handle); + } + HandleScope scope; Py_Initialize(); + PyObject* sysPath = PySys_GetObject((char*)"path"); + PyObject* curDir = PyString_FromString("python"); + PyList_Insert(sysPath, 0, curDir); + Py_DECREF(curDir); + PyObjectWrapper::Initialize(); // module.exports.import