File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -488,13 +488,18 @@ def _write_libinit_py(self, libnames):
488488 init += "\n "
489489
490490 if libnames :
491- init += "from ctypes import cdll\n \n "
491+ if self .platform .os == "osx" :
492+ init += "from ctypes import CDLL, RTLD_GLOBAL\n \n "
493+ else :
494+ init += "from ctypes import cdll\n \n "
492495
493496 for libname in libnames :
494497 init += "try:\n "
495- init += (
496- f' _lib = cdll.LoadLibrary(join(_root, "lib", "{ libname } "))\n '
497- )
498+ if self .platform .os == "osx" :
499+ init += f' _lib = CDLL(join(_root, "lib", "{ libname } "), mode=RTLD_GLOBAL)\n '
500+ else :
501+ init += f' _lib = cdll.LoadLibrary(join(_root, "lib", "{ libname } "))\n '
502+
498503 init += "except FileNotFoundError:\n "
499504 init += f' if not exists(join(_root, "lib", "{ libname } ")):\n '
500505 init += f' raise FileNotFoundError("{ libname } was not found on your system. Is this package correctly installed?")\n '
You can’t perform that action at this time.
0 commit comments