Hi Brion, Le vendredi 22 mai 2015 13:21:03 UTC+2, Brion Vibber a écrit : > > You can prepend or append additional JavaScript code to the generated > module by specifying a file via the --pre-js or --post-js options on emcc > (or by just taking the output JS and manually appending to it). This should > make it fairly straightforward to set up initialization, such as by setting > module options in a --pre-js, or creating a wrapper function that does the > async setup for you. > > I use this to add some utility functions to the Module. But this doesn't help, since the code is added inside the function generated by MODULARIZE
> Another thing that may help: if asynchronous setup of the module doesn't > fit well with your code model, you can disable the memory file with > "--memory-init-file 0" so all the code loading and initializers run > immediately. This will however increase the total size of your code, as the > data segments will be included as an array in the JS instead of a separate > data file. > > > This didn't directly work either. Even without a memory init file, global initializers (which setup embind bindings) are called asynchronously and i cannot directly call code using my_lib. However, it works if you use the load event : var my_lib = My_lib(); window.onload = do_something; That's a start, thanks :) How reliable do you think this is ? -- 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.
