Both modules have memory segments. By asking the lines (import "env" "memoryBase" (global $memoryBase i32)) and (import "env" "tableBase" (global $tableBase i32)) in our generated oddly, the wasm-merge runs without errors.
But I'm still not clear in how functions exported by one module (the fastmath version of math functions) can be imported (= used) but the other one? Is that possible? Thanks. Le mercredi 22 novembre 2017 19:08:03 UTC+1, Alon Zakai a écrit : > > We should support both 1 and 2, not hard, just hasn't been done yet. > > But first, let me ask about your use case: the "no memory base was > imported" message is too general (we should fix that), but it is there > because if there isn't a memory base, then memory isn't relocatable, and we > can't merge memories. So that can only work if the modules don't have > memory segments. Is that the case for you, it's just code, not data? > > If you don't have data, then as a temporary workaround you can just import > the relocatable offsets, adding > > (import "env" "memoryBase" (global $memoryBase i32)) > (import "env" "tableBase" (global $tableBase i32)) > > But we should also make it work if those don't exist, assuming there is no > data. > > > On Wed, Nov 22, 2017 at 2:20 AM, <[email protected] <javascript:>> wrote: > >> Hi, >> >> Our Faust compiler (faust.grame.fr) can directly generate wasm modules >> from the Faust DSP source code. We typically generate modules that need >> mathematical functions (log, sin, pow...) which are imported from the JS >> context (by generating the appropriate module "import" section). >> >> We would like to test our Faust generated wasm code using more >> optimized mathematical functions (so using a fast_log, fast_sin, fast_pow >> versions of the functions). Those functions are coded in a C++ file, then >> compiled as a wasm module using emcc -O3 -s WASM=1 -s >> SIDE_MODULE=1 fastmath.cpp -o fastmath.wasm. >> >> Then we tried to link the fastmath.wasm module using the wasm-merge tool, >> so doing (for a given pre-compiled Faust DSP filterBank.wasm module) : >> wasm-merge >> filterBank.wasm fastmath.wasm, but we get the error : "Fatal: no memory >> base was imported" >> >> 1) is the wasm-merge tool ready for that kind of use case? If yes how it >> should be used? >> >> 2) will the wasm-merge code be part of the binaryen.js library, so that >> liking wasm modules could possibly dynamically be done in a Web page, or >> used in nodejs context for instance ? >> >> Thanks. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "emscripten-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
