Skip to content

Support for offline cmo/cma to javascript compilation #369

@ejgallego

Description

@ejgallego

Dear jsoo devs,

is it possible to compile *.cma files with jsoo such that they can be later used by Dynlink.loadfile?

In jscoq, we must dynamically load pretty large cma plugins, which makes the user wait for a few minutes of bytecode to js compilation sometimes (see also #334, #307). Also, having to link the whole jsoo into the output js file is a bit heavyweight.

We have seen that jsoo accepts cma/cmo input files, however the naive approach of eval'ing this js at caml_reify_bytecode doesn't work.

I'm sorry if this is possible to do, but we were clueless on how to do it. Any help hint on how to solve this issue would be greatly appreciated.

I have setup a small repository with a dynamic loading example at:

https://github.com/ejgallego/jsoo-dl-test/

The output of jsoo command line is at:

https://github.com/ejgallego/jsoo-dl-test/blob/master/outputs/module.js

and the one from the jsoo browser embedded compiler is:

https://github.com/ejgallego/jsoo-dl-test/blob/master/outputs/module_from_browser.js

I'm not even sure how to try to load the first one.

Thanks,
Emilio

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions