How to set program name?

68 Views Asked by At

How to set program name/argument 0 (argv[0]) with emcc? For example, emcc hello.c -o hello.html with --set-name main*.

This is not the same as setting Module.arguments (which changes arguments 1 and up, I want argument 0).

  • in auto-generated hello.js, there is var thisProgram="./this.program". Changing directly gives Uncaught TypeError: str.charCodeAt is not a function
  • using Module["thisProgram"]="./main"; in --pre-js gives Uncaught TypeError: str.charCodeAt is not a function

This is for web (with .html), so renaming hello.js to main.js does not work (it is still ./this.program).


  • main is just a placeholder. It will be something other than the default ./this.program.
0

There are 0 best solutions below