@ale wrote:
I’m trying to use BER MetaOCaml in a dune project. I was reading through several posts and github issues and didn’t manage to find any concrete examples. After trying many things, the following kinda works:
dune
(executable (name foo) (link_flags dynlink.cmxa compiler-libs/ocamlcommon.cmxa codelib.cmx runnative.cmx) (modes native))
bin/foo.ml
let string_of_code c = let () = Codelib.print_code Format.str_formatter c in Format.flush_str_formatter () let () = let c = .<1 + 2>. in let res = Runnative.run c in Printf.printf "Code: %s\nResult: %d\n" (string_of_code c) res
output of
dune exec bin/foo.exe
:Code: .<1 + 2>. Result: 3
As you can see, there’s the horrible
link_flags
hack that scares children and adults alike. It also limits the mode tonative
(you could probably come up with a similar hack forbyte
mode). I would like to know if there’s a way to cleanly use metaocaml with dune. Thanks.Relevant:
- https://github.com/ocaml/dune/issues/1413.
- https://github.com/ocaml/opam-repository/pull/13474
opam switch show
is4.07.1+BER
.
Posts: 9
Participants: 2