| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 960286d commit 2910074
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -404,6 +404,7 @@ def _build_monoclr(self): | |||
| 404 | 404 | # build the clr python module | |
| 405 | 405 | clr_ext = Extension( | |
| 406 | 406 | "clr", | |
| 407 | + language="c++", | ||
| 407 | 408 | sources=["src/monoclr/pynetinit.c", "src/monoclr/clrmod.c"], | |
| 408 | 409 | extra_compile_args=cflags.split(" "), | |
| 409 | 410 | extra_link_args=libs.split(" "), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,6 +12,10 @@ | |||
| 12 | 12 | #define MONO_DOMAIN "Python.Runtime" | |
| 13 | 13 | #define PR_ASSEMBLY "Python.Runtime.dll" | |
| 14 | 14 | ||
| 15 | + #ifdef __cplusplus | ||
| 16 | + extern "C" { | ||
| 17 | + #endif | ||
| 18 | + | ||
| 15 | 19 | typedef struct | |
| 16 | 20 | { | |
| 17 | 21 | MonoDomain *domain; | |
@@ -29,4 +33,8 @@ void PyNet_Finalize(PyNet_Args *); | |||
| 29 | 33 | void main_thread_handler(PyNet_Args *user_data); | |
| 30 | 34 | char *PyNet_ExceptionToString(MonoObject *); | |
| 31 | 35 | ||
| 36 | + #ifdef __cplusplus | ||
| 37 | + } | ||
| 38 | + #endif | ||
| 39 | + | ||
| 32 | 40 | #endif // PYNET_CLR_H | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,15 @@ PyNet_Args *PyNet_Init(int ext) | |||
| 19 | 19 | pn_args->shutdown = NULL; | |
| 20 | 20 | pn_args->module = NULL; | |
| 21 | 21 | ||
| 22 | + #ifdef __linux__ | ||
| 23 | + // Force preload libmono-2.0 as global. Without this, on some systems | ||
| 24 | + // symbols from libmono are not found by libmononative (which implements | ||
| 25 | + // some of the System.* namespaces). Since the only happened on Linux so | ||
| 26 | + // far, we hardcode the library name, load the symbols into the global | ||
| 27 | + // namespace and leak the handle. | ||
| 28 | + dlopen("libmono-2.0.so", RTLD_LAZY | RTLD_GLOBAL); | ||
| 29 | + #endif | ||
| 30 | + | ||
| 22 | 31 | if (ext == 0) | |
| 23 | 32 | { | |
| 24 | 33 | pn_args->init_name = "Python.Runtime:Initialize()"; | |
@@ -122,7 +131,7 @@ void main_thread_handler(PyNet_Args *user_data) | |||
| 122 | 131 | strcpy(new_ld_library_path, py_libdir); | |
| 123 | 132 | strcat(new_ld_library_path, ":"); | |
| 124 | 133 | strcat(new_ld_library_path, ld_library_path); | |
| 125 | - setenv("LD_LIBRARY_PATH", py_libdir, 1); | ||
| 134 | + setenv("LD_LIBRARY_PATH", new_ld_library_path, 1); | ||
| 126 | 135 | } | |
| 127 | 136 | } | |
| 128 | 137 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -174,6 +174,8 @@ def preprocess_python_headers(): | |||
| 174 | 174 | include_py = sysconfig.get_config_var("INCLUDEPY") | |
| 175 | 175 | include_dirs.append(include_py) | |
| 176 | 176 | ||
| 177 | + include_args = [c for p in include_dirs for c in ["-I", p]] | ||
| 178 | + | ||
| 177 | 179 | defines = [ | |
| 178 | 180 | "-D", "__attribute__(x)=", | |
| 179 | 181 | "-D", "__inline__=inline", | |
@@ -198,7 +200,7 @@ def preprocess_python_headers(): | |||
| 198 | 200 | defines.extend(("-D", "PYTHON_WITH_WIDE_UNICODE")) | |
| 199 | 201 | ||
| 200 | 202 | python_h = os.path.join(include_py, "Python.h") | |
| 201 | - cmd = ["clang", "-pthread", "-I"] + include_dirs + defines + ["-E", python_h] | ||
| 203 | + cmd = ["clang", "-pthread"] + include_args + defines + ["-E", python_h] | ||
| 202 | 204 | ||
| 203 | 205 | # normalize as the parser doesn't like windows line endings. | |
| 204 | 206 | lines = [] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments