-
Notifications
You must be signed in to change notification settings - Fork 188
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
[BUG] Using two Js_of_ocaml compiled libraries in the same runtime causes issues with js stubs #1622
Comments
First note that It seems to me that vscode-ocaml-platform is part of the problem here. It should not update the global object,it should defined its own stubs. |
What is the correct way to access a JS stub without making it available on some global context like |
https://ocsigen.org/js_of_ocaml/latest/manual/linker gives some information. In short, //Provides: customAdd
function customAdd(a,b){
return a + b
} external add : int -> int -> int = "customAdd" |
I've worked on a bunch of changes to limit global side effects (#1708, #1696) |
I'm opening ocamllabs/vscode-ocaml-platform#1617 and will close this one |
Describe the bug
If two separate ocaml libraries have JS stubs which define the same symbol ion
joo_global_object
(e.g. two different versions of src-bindings/node/dune in the OCaml VSCode extension) they will conflict when both libraries are loaded by differentJs_of_ocaml
executable.This happens because
joo_global_object
is theglobalThis
, and so the two values override each other.Normally, when running a single application this is not a problem since we can control all the dependencies and ensure they don't conflict. But specifically in the case of the VSCode extension, this causes issues when there are two
Js_of_ocaml
extensions that use incompatible versions of the nodejs binding stubs.Expected behavior
Both
Js_of_ocaml
executable should be able to run independently in the same JS environment.The text was updated successfully, but these errors were encountered: