[SciPy-User] swig and OpenMP

Dag Sverre Seljebotn dagss@student.matnat.uio...
Fri Feb 12 09:15:30 CST 2010


Rohit Garg wrote:
> It's another symptom of a much bigger disease.
>
> Whenever you ask your compiler (atleast GCC) to instrument your code,
> certain symbols are added. These symbols are
> undocumented/subject-to-change.
>
> Whenever you try to import such a module into python, the dynamic
> library loader will complain about these symbols.
>
> For instance, if you try to  compile your extension module with
> Profile guided optimization, you'll land into the same problems.
>
> The only reasonable fix I see for these kinds of problems is to embed
> Python instead of extending it. Unfortunately, it also seems to be a
> lot less popular/easy/common.
>   
In some situations, it might help to simply call sys.setdlopenflags though:

import sys
import ctypes

try:
    _old_rtld = sys.getdlopenflags()
    sys.setdlopenflags(_old_rtld|ctypes.RTLD_GLOBAL)
    import yourmod
finally:
    sys.setdlopenflags(_old_rtld)



Dag Sverre


More information about the SciPy-User mailing list