|
9 | 9 | # Version setup.
|
10 | 10 | from ._version import __version__
|
11 | 11 |
|
12 |
| -import os as _os |
13 | 12 | import cloudpickle as _cloudpickle
|
14 | 13 | from threading import Lock as _Lock
|
15 | 14 |
|
16 |
| -if _os.name == "posix": |
17 |
| - # NOTE: on some platforms Python by default opens extensions |
18 |
| - # with the RTLD_LOCAL flag, which creates problems because |
19 |
| - # public symbols used by heyoka (e.g., sleef functions, quad |
20 |
| - # precision math) are then not found by the LLVM jit machinery. |
21 |
| - # Thus, before importing core, we temporarily flip on the |
22 |
| - # RTLD_GLOBAL flag, which makes the symbols visible and |
23 |
| - # solves these issues. Another possible approach suggested |
24 |
| - # in the llvm discord is to manually and explicitly add |
25 |
| - # libheyoka.so to the DL search path: |
26 |
| - # DynamicLibrarySearchGenerator::Load(“/path/to/libheyoka.so”) |
27 |
| - # See: |
28 |
| - # https://docs.python.org/3/library/ctypes.html |
29 |
| - import ctypes as _ctypes |
30 |
| - import sys as _sys |
31 |
| - |
32 |
| - _orig_dlopen_flags = _sys.getdlopenflags() |
33 |
| - _sys.setdlopenflags(_orig_dlopen_flags | _ctypes.RTLD_GLOBAL) |
34 |
| - |
35 |
| - try: |
36 |
| - # We import the sub-modules into the root namespace. |
37 |
| - from .core import * |
38 |
| - finally: |
39 |
| - # Restore the original dlopen flags whatever |
40 |
| - # happens. |
41 |
| - _sys.setdlopenflags(_orig_dlopen_flags) |
42 |
| - |
43 |
| - del _ctypes |
44 |
| - del _sys |
45 |
| - del _orig_dlopen_flags |
46 |
| -else: |
47 |
| - # We import the sub-modules into the root namespace. |
48 |
| - from .core import * |
49 |
| - |
50 |
| -del _os |
| 15 | +# We import the sub-modules into the root namespace. |
| 16 | +from .core import * |
51 | 17 |
|
52 | 18 | # Explicitly import the submodules
|
53 | 19 | # NOTE: it is *important* that the import is performed
|
|
0 commit comments