ocaml / ocaml

The core OCaml system: compilers, runtime system, base libraries
https://ocaml.org
Other
5.19k stars 1.06k forks source link

Include prims.o in libcamlrun_shared.so #13132

Open yallop opened 2 weeks ago

yallop commented 2 weeks ago

I'd like to use libcamlrun_shared.so from other languages, but it has an undefined symbol caml_names_of_builtin_cprim:

$ python3 -c "import ctypes; ctypes.CDLL('runtime/libcamlrun_shared.so')"

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: runtime/libcamlrun_shared.so: undefined symbol: caml_names_of_builtin_cprim

This PR includes prims.o in the shared object so that the symbol is no longer undefined:

$ python3 -c "import ctypes; ctypes.CDLL('runtime/libcamlrun_shared.so')"
$