From 097a6ae4b0892f276a1ebe0fcaa1508149a1b459 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Thu, 21 May 2009 19:28:13 +0000 Subject: [PATCH] python.cpp: Importing binary Python extensions now works more reliably on Linux. Thanks to Phil Ashby for the patch! --- python.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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();