-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE REQUEST] Pre-compiled Dynlink
for .cma
files without linking compiler-libs/js_of_ocaml-compiler
#1675
Comments
There is a tests checking that one can load precompiled cmo successfully. It lives in It seems that there is an issue if one compile the main program with the jsoo Do you really need Alternatively, the following patch/hack should fix your issue. //Provides: caml_register_global (const, shallow, const)
//Requires: caml_global_data, caml_callback, caml_build_symbols
//Requires: caml_failwith
function caml_register_global(n, v, name_opt) {
if (name_opt) {
var name = name_opt;
if (globalThis.toplevelReloc) {
n = caml_callback(globalThis.toplevelReloc, [name]);
} else if (caml_global_data.symbols) {
if (!caml_global_data.symidx) {
caml_global_data.symidx = caml_build_symbols(caml_global_data.symbols);
}
var nid = caml_global_data.symidx[name];
if (nid >= 0) n = nid;
else {
- caml_failwith("caml_register_global: cannot locate " + name);
+ n = caml_global_data.length - 1;
}
} |
The thing is that lhe ocamlc link flag |
fixed by #1676 |
Thanks a lot @hhugo ! |
Is your feature request related to a problem? Please describe.
jsCoq usually requires to
Dynlink.loadfile
of some heavy.cma
files (plugins in Coq terminology to work.Loading such files with JSOO
Dynlink.loadfile
support works fine, but it is usually quite slow, and moreover increases the output.js
file by almost 3 MiB (50%) as it will linkjs_of_ocaml-compiler
.Describe the solution you'd like
I'd be great if we could precompile the
.cma
files to.js
files, and load them without having to link the compiler.Describe alternatives you've considered
For jsCoq and JSOO 4.0.0 , this used to work. Updating to JSOO 5.8.3 is done here https://github.com/jscoq/jscoq/pull/372/files#diff-89191e3161815dcdaf5594e6d98bfaa5ab81f742ccbeb9f5a657655c27504cdcR16, that also works, however it increases the binary size by almost 50% as we need to link the compiler.
I tried to provide my own version of
toplevelReloc
, which seems to be the only missing primitive for this to work, but without success.The text was updated successfully, but these errors were encountered: