Emrun by default routes GET parameters to an array Module.arguments = []; , which Emscripten apps read by default to argc+argv. It's a very short snippet of code: https://github.com/kripken/emscripten/blob/master/src/emrun_prejs.js . Though emrun is generally used by automating command line runs of a compiled page, so you may just want to copy that code to your shell .html file (and pass the linker flag --shell-file myshell.html to use it).
2015-09-10 20:47 GMT+03:00 Alon Zakai <[email protected]>: > main() argc/argv are set from Module.arguments, which is just a list of > strings. You could copy the GET params from the url into that. I don't > think we have a utility anywhere to do it automatically, although maybe > emrun does that? > > On Thu, Sep 10, 2015 at 8:51 AM, Robert Goulet <[email protected] > > wrote: > >> Hi all, >> >> Is it possible to have an Emscripten generated html to take the http >> parameters (GET or POST) and pass them to the C/C++ main as argc/argv? >> >> For example, browsing to: >> >> http://127.0.0.1:80/index.html?param1=hello¶m2=42 >> >> I would expect that in int main(int argc, char* argv[]) contains: >> >> argc = 5 >> argv[0] = "index.html" >> argv[1] = "param1" >> argv[2] = "hello" >> argv[3] = "param2" >> argv[4] = "42" >> >> Or is there something equivalent that works just as well? >> >> 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]. >> 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. > -- 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.
