Skip to content

Commit 0154fc3

Browse files
Use unique name for shared library
1 parent d48b523 commit 0154fc3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/runtime/lpython/lpython.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,13 @@ def get_data_type(t):
700700
// Define the module initialization function
701701
static struct PyModuleDef module_def = {{
702702
PyModuleDef_HEAD_INIT,
703-
"lpython_jit_module",
703+
"lpython_module_{self.fn_name}",
704704
"Shared library to use LPython generated functions",
705705
-1,
706706
module_methods
707707
}};
708708
709-
PyMODINIT_FUNC PyInit_lpython_jit_module(void) {{
709+
PyMODINIT_FUNC PyInit_lpython_module_{self.fn_name}(void) {{
710710
PyObject* module;
711711
712712
// Create the module object
@@ -748,12 +748,13 @@ def get_data_type(t):
748748
python_lib = "-L" + get_python_lib() + "/../.. -lpython3.10 -lm"
749749

750750
r = os.system("gcc -g" + gcc_flags + python_path + numpy_path +
751-
filename + ".c -o lpython_jit_module.so " +
751+
filename + ".c -o lpython_module_" + self.fn_name + ".so " +
752752
rt_path_01 + rt_path_02 + python_lib)
753753
assert r == 0, "Failed to create the shared library"
754754

755755
def __call__(self, *args, **kwargs):
756756
import sys; sys.path.append('.')
757757
# import the symbol from the shared library
758-
function = getattr(__import__("lpython_jit_module"), self.fn_name)
758+
function = getattr(__import__("lpython_module_" + self.fn_name),
759+
self.fn_name)
759760
return function(*args, **kwargs)

0 commit comments

Comments
 (0)