Closed PioBeat closed 5 years ago
Dune does not support ocamljava
, so you will have to
resort to either ocamlbuild
or make
.
From what I understand, you should be able to manually build your project through the following commands:
cd libs
ocamljava -c SimpleLib.mli
ocamljava -c SimpleLib.ml
cd ..
ocamljava -I libs -c main.ml
ocamljava -o myprog.jar libs/SimpleLib.cmj main.cmj
Hope this helps.
Thank you for your answer. The solution works!
The only thing I had to do additionally was to remove the open Libs
statement at the beginning of the main.ml
file. Is this considered as an error?
Otherwise, ocamljava successfully produces the *.jar.
The only thing I had to do additionally was to remove the
open Libs
statement at the beginning of themain.ml
file. Is this considered as an error?
Sorry, I overlooked this part; indeed, OCaml (at the language level)
does not use the file hierarchy. Your SimpleLib
module is then
not part of a libs
module, it is a toplevel module.
Hello! I encountered a problem when trying to generate the corresponding Java code for an OCaml program that is defining a dependency.
Consider the following example. The script
main.ml
is referring to a library:The library called
SimpleLib
is located in the directory./libs/
. ForSimpleLib.ml
:And
SimpleLib.mli
:This call from the command-line
ocamljava -java-package wraptest -c main.ml
is producing this error:How can I tell ocamljava to include this library? I use dune as build system which generates also a
*.a
and*.cmxa
file.The question on StackOverflow is related https://stackoverflow.com/questions/26227269/failing-to-link-standard-library-in-ocaml-java to my issue but unfortunately, the answers did not help.
My system details are: