Hello,
I would like to get the underlying operating system in my program.
I found numerous solutions to this, but they all spawn an external process, e.g.
- Library to get OS information (arch, system, distribution, release ...) (avsm/osrelease)
- `ocamlc -config`
I tried to solve this using dune:
(executable
(name main))
(rule
(target config.ml)
(action
(with-stdout-to
%{target}
(run sh -c "printf 'let os_type = \"%s\"' \"$(uname)\""))))
let () =
print_endline Config.os_type
Code: <div style="background-color:black;color:white;text-align:center.
This is annoying tho, one solution also could be to call c code, is there something that solved this or plans there to introduce it in ocaml?