With this command, the plugin is not registered. Which supplementary steps are needed?
When the package is installed on a system, shouldn’t we expect to run the binary without dune?
Could it have to do with file name resolution? In your main program you call Dynlink.loadfile "somewhere" with a location of a to-be-dynlinked compilation unit. It could happen easily that in your invocation “somewhere” does not point to the correct file?
I see. If I understand the dune-sites docs correctly, under the hood, Dynlink.load_file is actually called, and that call must reside in the generated sites module (‘sites.ml’ in the doc example).
You could try to fully install the package to see if it works then. I.e. let dune generate opam files and then opam-install your package into the current opam switch. I suspect this will produce a different situation than directly running the program from _build/install
Also, trying building with --verbose may shed some light what is actually done by dune build @install
The issue came from the way my system install packages. I use guix and OCAMLPATH was not set correctly when installing the plugin package. I was able to fix it.