-
Notifications
You must be signed in to change notification settings - Fork 197
Description
Hello,
Suppose I have a program with a module offering a plugin interface (some register function).
I compile this program using js_of_ocaml and make an HTML page load this script. Fine.
Now when I compile a plugin.ml file to plugin.cmo then to plugin.js, I get this error in the browser console when it is loaded: ReferenceError: caml_get_global_data is not defined.
Are there any compilation flags to make this work ? I tried a --no-runtime with no success.
I saw there is some Dynlink support but the --file and pseudo filesystem is not very clear. I made a test: First I compile plugin.ml to plugin.cmo. Then I add a dummy.ml file with:
Dynlink.loadfile "plugin.cmo";;I compile this file and create a plugin.js file:
ocamlfind ocamlc -c -package js_of_ocaml.ppx dummy.ml
js_of_ocaml -o plugin.js -I ./ --file=plugin.cmo dummy.cmo
Now when loading plugin.js in the test page, I get: ReferenceError: caml_fs_register.
My goal is to be able to fetch cm{o,a} or .js files from urls and load them in my js_of_ocaml-compiled application.