-
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
How to control the exported symbols of a side module? #23107
Comments
Because of the C++ one definition rule each module (or each TU) that instinstantatesantiates a template must define it as a weak symbol. This way it can exist in mulitple modules and the dynamic linker will pick just one of them at runtime. In this case the side module exports this definition and then also imports it via the |
I understand what you mean, thank you for your explanation. However, I think the main module should at least initialize successfully on its own since I used the AUTOLOAD_DYLIBS=0 option. It should only throw an error later if a symbol is needed but the side module hasn't been loaded yet. |
That does sounds correct yes. Sounds like a different issue, but one that is probably worth fixing. |
I used the -fvisibility=hidden option, but it doesn't seem to work completely.
side.cpp
check the exported symbol in wat format
It's strange, is
_ZNSt3__215basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev
a system library symbol? Why is it being exported in the side module?If I instantiate main module without side.wasm, I got an undefined symbol error of
_ZNSt3__215basic_stringbufIcNS_11char_traitsIcEENS_9allocatorIcEEED2Ev
If there is a way to control the exported symbols of a side module? I want my side module to export only the symbols I need so that the initialization of the main module does not depend on any side module. This way, I can load the side modules on demand later.
The text was updated successfully, but these errors were encountered: