Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use OCaml in embedded mode?

Tags:

interop

ocaml

Some time ago I emerged for myself that Guile and Racket can be embedded and be called right from any C++ application.

Can OCaml work like this?

like image 261
cnd Avatar asked Dec 26 '11 11:12

cnd


2 Answers

You can have a look at the Embedded O'Caml Toplevel done by Clément Capel. It's the result of a summer internship so it wasn't updated since 2004.

Otherwise, there is ocamlmklib.

like image 87
Clement J. Avatar answered Nov 15 '22 10:11

Clement J.


You can use the OCaml toplevel as a library. It is part of the official OCaml distribution and up-to-date. See toploop.mli in OCaml sources for the interface. It is officially only available in bytecode, but there is experimental support for native code.

If you plan to redistribute your application, be aware that the toplevel library (and the compiler itself) are under a more restrictive license (modified QPL) than the standard library and runtime (modified LGPL).

like image 31
Stéphane Glondu Avatar answered Nov 15 '22 10:11

Stéphane Glondu