Salome HOME
Fix problem in salome_test.py caused by recent replacement of pointe.med file
[modules/kernel.git] / src / KERNEL_PY / salome.py
index 00371c4886fb3cc13ea5223039b0bb4533c1dd36..f6afea4d1dd598714cc48e8ab8c0d8c67c55a1a8 100755 (executable)
@@ -86,6 +86,43 @@ from salome_kernel import *
 from salome_study import *
 from salome_iapp import *
 
+
+#
+# The next block is workaround for the problem of shared symbols loading for the extension modules (e.g. SWIG-generated)
+# that causes RTTI unavailable in some cases. To solve this problem, sys.setdlopenflags() function is used.
+# Depending on the Python version and platform, the dlopen flags can be defined in the dl, DLFUN or ctypes module.
+# 
+import sys
+flags = None
+if not flags:
+    try:
+        # dl module can be unavailable
+        import dl
+        flags = dl.RTLD_NOW | dl.RTLD_GLOBAL
+    except:
+        pass
+    pass
+if not flags:
+    try:
+        # DLFCN module can be unavailable
+        import DLFCN
+        flags = DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL
+    except:
+        pass
+    pass
+if not flags:
+    try:
+        # ctypes module can be unavailable
+        import ctypes
+        flags = ctypes.RTLD_GLOBAL
+    except:
+        pass
+    pass
+    
+if flags:
+    sys.setdlopenflags(flags)
+    pass
+
 orb, lcc, naming_service, cm,sg=None,None,None,None,None
 myStudyManager, myStudyId, myStudy, myStudyName=None,None,None,None