[Python-bugs-list] [Bug #119483] OpenBSD can't dynamically load modules

noreply@sourceforge.net noreply@sourceforge.net
Thu, 26 Oct 2000 14:11:00 -0700


Bug #119483, was updated on 2000-Oct-26 14:11
Here is a current snapshot of the bug.

Project: Python
Category: Core
Status: Open
Resolution: None
Bug Group: Platform-specific
Priority: 5
Summary: OpenBSD can't dynamically load modules

Details: 
On OpenBSD, one always gets a traceback trying to import a '.so' module (replacing blahblahblah with module name):

ImportError: dynamic module does not define init function (initblahblahblah)

The problem is that dynload_shlib.c doesn't prepend an underscore to the symbol name (the C standard for naming function exports). Some OS's will try both the name with and without the underscore, some try only the literal symbol name when calling dlsym. OpenBSD requires the literal symbol. Hence, the following patch is in order:

--- dynload_shlib.c    Thu Oct 26 11:10:36 2000
+++ dynload_shlib.c     Thu Oct 26 11:10:51 2000
@@ -55,7 +55,7 @@
        }
 
        /* ### should there be a leading underscore for some platforms? */
-       sprintf(funcname, "init%.200s", shortname);
+       sprintf(funcname, "_init%.200s", shortname);
 
        if (fp != NULL) {
                int i;


For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=119483&group_id=5470