I'm not sure what "export of the index" means. On Monday, April 15, 2019 at 1:34:24 PM UTC-7, Alon Zakai wrote: > > There is no direct way to get the function pointer from the function > itself. That is, if bar was exported, you can call it but you don't know > its index in the function table. > > Options are to either export a function like you suggest, or to add an > export of the index. > > On Wed, Apr 10, 2019 at 8:46 PM Brian Craft <[email protected] > <javascript:>> wrote: > >> Should read "return bar" :-p >> >> On Wednesday, April 10, 2019 at 8:28:10 PM UTC-7, Brian Craft wrote: >>> >>> Is there a way to access a function pointer from javascript without >>> writing a wasm method to retrieve it? >>> >>> E.g. if I've exported functions 'foo' and 'bar', and 'foo' takes 'bar' >>> as an argument, how can I make the call from javascript? >>> >>> I can write another method that just returns the 'bar' pointer, >>> something like >>> >>> typedef void (*voidfn)(); >>> >>> voidfn getBar() { >>> return foo; >>> } >>> >>> and make the call with >>> >>> Module._foo(Module._getBar()) >>> >>> My question is can I get the bar pointer from the exports without having >>> to also write and export getBar()? >>> >>> -- >> 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.
