From 8273f62ac1614fa043defccb8ccf17192ee06750 Mon Sep 17 00:00:00 2001 From: Martin Gasser Date: Mon, 2 Jun 2014 19:30:07 +0200 Subject: [PATCH] applied patch --- src/binding.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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