From 930b333d3b61ebe740ccbac952ba86791555298c Mon Sep 17 00:00:00 2001 From: "elias.bachaalany" Date: Sat, 11 Sep 2010 09:34:14 +0000 Subject: [PATCH] bugfix: idaapi.enable_extlang_python() could not be called from init.py --- python.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python.cpp b/python.cpp index 2ae2820..499f223 100644 --- a/python.cpp +++ b/python.cpp @@ -1207,7 +1207,7 @@ bool IDAPython_Init(void) char tmp[MAXSTR+64]; #ifdef __LINUX__ // Export symbols from libpython to resolve imported module deps - qsnprintf(tmp, sizeof(tmp), "libpython%d.%d.so", + qsnprintf(tmp, sizeof(tmp), "libpython%d.%d.so.1", PY_MAJOR_VERSION, PY_MINOR_VERSION); if ( !dlopen(tmp, RTLD_NOLOAD | RTLD_GLOBAL | RTLD_LAZY) ) @@ -1259,6 +1259,10 @@ bool IDAPython_Init(void) VER_SERIAL); PyRun_SimpleString(tmp); + // Install extlang. Needs to be done before running init.py + // in case it's calling idaapi.enable_extlang_python(1) + install_extlang(&extlang_python); + // Execute init.py (for Python side initialization) qmakepath(tmp, MAXSTR, g_idapython_dir, "init.py", NULL); if ( !PyRunFile(tmp) ) @@ -1299,9 +1303,6 @@ bool IDAPython_Init(void) // Enable the CLI by default enable_python_cli(true); - // Install extlang - install_extlang(&extlang_python); - g_initialized = true; pywraps_nw_notify(NW_INITIDA_SLOT); return true;