__post_instantiate is a way to run code when the module is loaded. For
example it could run global constructors, which languages like C++ have.
This is necessary not just for dynamic linking but also a single file by
itself.

(wasm modules also have an optional start(), but that isn't good enough for
everything, due to reentrancy issues - start() is called when the wasm
instance is still being created, while __post_instantiate is called after
the instance was created.)


On Wed, Aug 9, 2017 at 6:28 PM, Jean Valjean <me...@hotmail.com> wrote:

> Hello there,
>
> Sorry for my approximate english.
>
> It is now possible to make a standalone WebAssembly file. I'm gladly to
> see that is possible now with Emscripten, thanks. I can now make my own
> HTML source content, with my own way to load the WebAssembly bytecode. But
> I don't understand why the "__post_instantiate" function is exported too ?
> The wiki at https://github.com/WebAssembly/tool-conventions/
> blob/master/DynamicLinking.md says it's about a dynamic link feature...
> but I feel that I just need a vanilla wasm file without such feature.
>
> It's how I compile my code currently :
>
> C:\dev\emscripten\emscripten\em++
> -s ONLY_MY_CODE=1
> -s WASM=1 -s SIDE_MODULE=2
> -s DISABLE_EXCEPTION_CATCHING=1
> -s AGGRESSIVE_VARIABLE_ELIMINATION=1
> -s EXPORTED_FUNCTIONS="['_myfunc','_myfunc2']"
> -std=c++11 -g0 -O3
> foo.cpp -o target.wasm
>
> Thanks,
> Jean
>
> --
> 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 emscripten-discuss+unsubscr...@googlegroups.com.
> 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 emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to