[C++-sig] Dynamic Cast failed over multiple modules

Mathieu Malaterre mathieu.malaterre at gmail.com
Thu Sep 8 12:00:06 CEST 2011


On Thu, Sep 8, 2011 at 11:56 AM, Holger Brandsmeier <brandsmeier at gmx.de> wrote:
[...]
> CMAKE_SHARED_LINKER_FLAGS. About the RTLD_GLOBAL flag for dlopen, I
> don't know how python handles this.
>
> Do you have any ideas how to solve this? Or is this simply not
> possible with python?

Here is what I use:

if os.name == 'posix':
  orig_dlopen_flags = sys.getdlopenflags()
  try:
    import dl
  except ImportError:
    try:
      import DLFCN as dl
    except ImportError:
      dl = None
  if dl:
    sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)
  # now load the module !
  from gdcmswig import *
  sys.setdlopenflags(orig_dlopen_flags)
  del dl
  del orig_dlopen_flags


ref:
http://gdcm.git.sourceforge.net/git/gitweb.cgi?p=gdcm/gdcm;a=blob;f=Wrapping/Python/gdcm.py;h=fd7ee0da80297d608c2939b8661ce0e81c33314a;hb=HEAD

-- 
Mathieu


More information about the Cplusplus-sig mailing list