diff --git a/python.cpp b/python.cpp index c904529..36e4313 100644 --- a/python.cpp +++ b/python.cpp @@ -19,6 +19,9 @@ #include #include +#ifdef __LINUX__ +#include +#endif #include #include #include @@ -618,6 +621,18 @@ bool IDAPython_Init(void) return false; } +#ifdef __LINUX__ + /* Export symbols from libpython to resolve imported module deps */ + qsnprintf(tmp, sizeof(tmp), "libpython%d.%d.so", + PY_MAJOR_VERSION, + PY_MINOR_VERSION); + if (!dlopen(tmp, RTLD_NOLOAD | RTLD_GLOBAL)) + { + warning("IDAPython: dlopen(%s) failed", tmp); + return false; + } +#endif + /* Start the interpreter */ Py_Initialize();