I want to implement shared library for Linux/FreeBSD in OCaml and I need it to have C interface. This way I will be able to implement bindings for various languages. I have several concerns:
- OCaml is garbage-collected and I'm afraid that objects passed to external code may be GC'ed. Is it possible to disable GC? Maybe there is another way to solve such problems?
- Is there a way to write OCaml code like C++'s
extern "C"
or alike so it will be exposed as C symbol? - Is there any similar high-level language which is better fit for writing solibs? I still need the language compiler to be written in C/C++ so it will be relatively easy to port it to new architectures.