-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
If multiple dynamic imports have the same dependency then local resolution of names fails #20203
Comments
I agree that fix looks good. However when trying to write a test for this I noticed that I can't reproduce it using Is there some reason you are calling |
I think the dlopen still won't work - if you have the following: Lib1 requires LibX However you open it, when you import lib1 as local, it will load libX (in loadDynamicLibrary) also as local. If you then dlopen lib2 as local, then loadDynamicLibrary will see the libX dependency is already loaded, and skip the missing line which does importing into the local namespace, and name resolution of symbols in libX will fail? |
I will try to write a dlopen regression test based on the scenario you describe. In the mean time, can you try converting your codebase to avoid directly calling the JS API? |
It's in here: https://github.com/pyodide/pyodide/blob/main/src/js/dynload.ts It's quite a big project - I can see that there is a workaround there for another case, which just loads all sub-dependency libraries as global, but it would be nicer if it worked like it should. It would be quite a refactor to change it to the C bit of pyodide though I think, and it isn't my project so I'm loath to mess with it. |
When a library is loaded for a second time we were only handling the RTLD_GLOBAL case. Fixes: #20203
When a library is loaded for a second time we were only handling the RTLD_GLOBAL case. Fixes: #20203
When a library is loaded for a second time we were only handling the RTLD_GLOBAL case. Fixes: #20203
I have a python extension build where:
loadDynamicLibrary(LIB,{global:false},localscope)
moduleLoaded
. For the second extension call though, it doesn't work, becausemoduleLoaded
gets skipped, so symbols never make their way into the local scope.I can load the C++ library globally, but I don't like polluting the global namespace like that. Or link it into each extension statically, but that is quite a code size jump.
I think what is needed is code after this code:
to merge the symbols into the local scope. Possibly as simple as just calling
If module is still 'loading' however I don't quite know what to do here? If we are async, then I guess we could wait for it to load, but if we are synchronous (and the other load is async), I guess we just have to throw an exception.
( all referring to
library_dylink.js
https://github.com/emscripten-core/emscripten/blob/main/src/library_dylink.js )The text was updated successfully, but these errors were encountered: