Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Toplevel "ocaml -plugin" is not usable #7570
Original bug ID: 7570
Since OCaml 4.03 and #6108, the dynlink library cannot be used inside the toplevel. However, like "ocamlc" and "ocamlopt", the toplevel "ocaml" provides a "-plugin" option. Trying to use this option yields a toplevel fatal error due to the uncatched exception:
"Invalid_argument("The dynlink.cma library cannot be used inside the OCaml toplevel")".
Comment author: @xavierleroy
Indeed, dynlink is not usable from the toplevel, because the toplevel provides its own dynlink-like mechanisms, see in particular the way the #load directive is implemented.
This said, the fact that no one noticed the issue until now suggests that there is no use for plugins inside the toplevel and that this functionality could also be removed.
Comment author: @Octachron
I gladly concede that the fact that I may be the first to stumble on this issue
However, this may be partially due to the lack of documentation for compiler plugins up to now.
In term of use case, I was thinking that with plugins working uniformly across the compilers and the toplevel, it may be possible to offload the internationalization of errors and warnings messages to a plugin with just a handful of new hooks in the compiler.