Ocamlmktop with an oasis

I am having problems adding a library to ocamlmktop.

I have a com directory with the object file com / com.cma.

If I run ocamlmktop com.cma -o top in the com directory, the resulting executable top seems to have a library; those. I can enter "Com.foo ;;" and it will give a signature of type foo in the Com module.

However, if I ran ocamlmktop com / com.cma -o top in the directory above com, then the resulting executable does not seem to have a library; that is, it responds to "Com.foo ;;" with "Error: Unbound module Com".

Is there a way to include libraries from different folders, or do I need to put all .cma files in the same folder?

In addition, I use the OASIS build system; Can I tell OASIS that I want to get these libraries?

Edit:

I found a partial solution: ocamlc -pack a / a.cmo b / b.cmo -o everything.cmo and then ocamlmktop all.cmo -o top; however, this requires duplicating all libraries and making them be submodules of the same supermodule.

+4
source share
1 answer

The reason you cannot use toplevel from the above directory is because the interface files (.cmi) are not included in the pools, and toplevel should find them on disk when the user accesses some module. So, either load the upper limit using -I com , or after loading #directory "com";; .

NB OASIS should support the construction of the top level in the next version (0.4.0).

+2
source

Source: https://habr.com/ru/post/1434716/


All Articles