Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can OCaml be used as a scripting language for C++?

I'm interesting in using OCaml as a scripting language for an application written in C++. Similarly to how languages like Lua, Python, or JavaScript can be used.

Is there any library (like there is LuaJIT for Lua, CPython for Python, or V8 for JavaScript) that I can use to run and interace with OCaml?

like image 204
user112513312 Avatar asked Apr 30 '16 22:04

user112513312


1 Answers

You can either embed the toplevel (REPL) in your application, or embed the compiler and dynlink the generated code (this is how ocaml_plugin works). The toplevel is provided by the compiler-libs library installed with the compiler.

like image 68
Pierre Chambart Avatar answered Oct 27 '22 15:10

Pierre Chambart