Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Custom c++ main arguments in qtloader.js
QtWS25 Last Chance

Custom c++ main arguments in qtloader.js

Scheduled Pinned Locked Moved Solved Qt for WebAssembly
webassemblyemscripten
2 Posts 1 Posters 664 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mixlu
    wrote on last edited by Mixlu
    #1

    Hi,

    I have a webassembly Qt app using two main arguments for my main.cpp. I have added the flag --emrun to my .pro file like this :

    QMAKE_LFLAGS += --emrun
    

    so, I am able to pass argument to the program via the url like this:

    http://127.0.0.1:8000/?FIRSTARG&SECONDARG
    

    But I don't like passing argument via the url, I would like to add them in the .html or .js if possible.

    I have seen this change who seems to make the job, so I tried to add :

    Module['arguments'] = ["FIRSTARG", "SECONDARG"];
    

    at the same place in the qtloader.js but without success

    Is it possible? Do you have any clues ?

    PS : I am using Qt 5.14.2 with emscripten 1.38.27

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mixlu
      wrote on last edited by
      #2

      Problem solved by removing the emrun flag. I can now specify custom arguments in the qtloader.js using emscripten's Module.arguments like this :

      Module['arguments'] = ['FirstArg', 'SecondArg'];
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved