[Python-Dev] Partial support for dlmodule.c in 64-bits OSes

Pierre Baillargeon pierrebai at hotmail.com
Thu Jul 13 22:10:11 CEST 2006


Currently, many 64-bits Oses cannot uses the dlmodule due to the conflicts
between the sizes of int, long and char *. That is well. The check is made as
run-time, which is also very well.

The problem is that the Python configuration script (setup.py) also makes the
check and plainly excludes dlmodule.c from being built and deployed. That is not
so well.

The reason is that we use the dlmodule solely to get access to the various flags
(RTLD_NOW, RTLD_GLOBAL, etc), so that we can do some magic with loaded shared
libraries, such as over-ridding the import mechanism so that the default load
flags get changed (via sys.setdlopenflags()) to force some semantics.

Currently this doesn't work on most 64-bits OSes because the dl module doesn't
exists, so it cannot be imported and its RTLD_* symbols are not accessible.

So I ask if it would be possible that the test for sys.maxint == 0x7fffffff in
setup.py be dropped in future releases.

Here's a relevant diff from the current setup.py in SVN:

1025,1030c1025,1029
+         # This requires sizeof(int) == sizeof(long) == sizeof(char*)
+         # but it will be tested at run-time: give access to the dl module so
+         # that RTDL_* symbols can be accessed.
+         dl_inc = find_file('dlfcn.h', [], inc_dirs)
+         if (dl_inc is not None) and (platform not in ['atheos']):
+             exts.append( Extension('dl', ['dlmodule.c']) )
---
-         if sys.maxint == 0x7fffffff:
-             # This requires sizeof(int) == sizeof(long) == sizeof(char*)
-             dl_inc = find_file('dlfcn.h', [], inc_dirs)
-             if (dl_inc is not None) and (platform not in ['atheos']):
-                 exts.append( Extension('dl', ['dlmodule.c']) )




More information about the Python-Dev mailing list