Currently, if multiple named exported functions share a single implementation, Wasm3 only exposes one of the exported functions to clients. This is because only the first name is saved to M3Function inside ParseSection_Export()
if (not io_module->functions [index].name)
{
io_module->functions [index].name = utf8;
utf8 = NULL; // ownership transfered to M3Function
}
A simple WebAssembly module illustrates this problem:
If you try to use m3_FindFunction() to find first(), you will succeed. However, trying to find second() will fail.
We have run into this problem when using Wasm3 with Libsodium. Libsodium exposes a number of different functions that wrap private constants, some of which are equal. These functions are all compiled down into the same WebAssembly function implementation with different exported names.
Currently, if multiple named exported functions share a single implementation, Wasm3 only exposes one of the exported functions to clients. This is because only the first name is saved to
M3Function
insideParseSection_Export()
A simple WebAssembly module illustrates this problem:
If you try to use
m3_FindFunction()
to findfirst()
, you will succeed. However, trying to findsecond()
will fail.We have run into this problem when using Wasm3 with Libsodium. Libsodium exposes a number of different functions that wrap private constants, some of which are equal. These functions are all compiled down into the same WebAssembly function implementation with different exported names.