diff options
author | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-06-11 07:23:23 +0200 |
---|---|---|
committer | ROUVREAU Vincent <vincent.rouvreau@inria.fr> | 2020-06-11 07:23:23 +0200 |
commit | e4a59f9ec6685534b03474cbcfe9395d601516e2 (patch) | |
tree | 44fd050a48da503de911600edab83f59201980b8 /src/python/gudhi/_distributor_init.py | |
parent | 70caa9be348c87526e2d41194a3618d14633b7dc (diff) |
Add distributor the right to add dll to the package
Diffstat (limited to 'src/python/gudhi/_distributor_init.py')
-rw-r--r-- | src/python/gudhi/_distributor_init.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/python/gudhi/_distributor_init.py b/src/python/gudhi/_distributor_init.py new file mode 100644 index 00000000..0ed451f9 --- /dev/null +++ b/src/python/gudhi/_distributor_init.py @@ -0,0 +1,18 @@ +''' +Helper to preload windows dlls to prevent dll not found errors. +Once a DLL is preloaded, its namespace is made available to any subsequent DLL. +''' +import os +from ctypes import WinDLL +import glob +if os.name == 'nt': + # convention for storing / loading the DLL from gudhi/.libs/, if present + try: + basedir = os.path.dirname(__file__) + except: + pass + else: + libs_dir = os.path.abspath(os.path.join(basedir, '.libs')) + if os.path.isdir(libs_dir): + for filename in glob.glob(os.path.join(libs_dir, '*dll')): + WinDLL(os.path.abspath(filename)) |