All, Thanks for info. I've looked at a bunch of different options, but have decided on the following course. Basically, my first attempt was to use SWIG (we use swig to assemble our python bindings) to put the following code in all of our py modules:
%pythoncode %{ import sys, dl sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) %} In general, this works. However, for one set of our bindings a module was being opened before this code was inserted. (Unfortunately, I couldn't figure out a way to tell SWIG to insert this code at the very top of a .py file). So, plan B was to use a post-process script. After building the .py file, I use a script to place the lines import sys, dl sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL) at the very top of the .py file. The script follows below. In my build system, I have the following target rules: module.cc module.py: module.i $(SWIG) -outdir ${curdir} -o $@ -python -c++ $< $(SWIGLD) module.py here SWIGLD is my post-process script included at the end of this email. Thanks for the help. Hope this information is useful to any who might have encountered this issue. Tom ________________________________ swigld.py import os, sys ##---------------------------------------------------------------------------## line0="## Set dlopen() to put all symbols in global space; needed for openmpi\n" line1="import sys, dl\n" line2="sys.setdlopenflags(sys.getdlopenflags() | dl.RTLD_GLOBAL)\n\n" filename = sys.argv[1] + ".temp" pyfile = open(filename, 'w') origfile = open(sys.argv[1], 'r') lines = origfile.readlines() origfile.close() pyfile.write(line0) pyfile.write(line1) pyfile.write(line2) pyfile.writelines(lines) pyfile.close() os.rename(filename, sys.argv[1]) -- Tom Evans Radiation Transport and Shielding Nuclear Science and Technology Division ------------------------------------------------ (865) 576-3535 Oak Ridge National Laboratory (865) 574-9619 fax PO Box 2008 MS6172 evan...@ornl.gov Oak Ridge, TN 37831-6170 www.ornl.gov/sci/radiation_transport_criticality ------------------------------------------------