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. How does Qt call C++ functions from JavaScript through webassembly?
QtWS25 Last Chance

How does Qt call C++ functions from JavaScript through webassembly?

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
javascriptexportfunctionwebassembly
3 Posts 3 Posters 1.8k 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.
  • A Offline
    A Offline
    AliGB
    wrote on last edited by AliGB
    #1

    To be clear, what functions/libraries does Qt use in JavaScript to make calls to wasm?

    1 Reply Last reply
    0
    • terma.abaT Offline
      terma.abaT Offline
      terma.aba
      wrote on last edited by
      #2

      If you mean: how can I call C++ procs from JavaScript/QML embedded in my application?
      This works just like on Qt for desktop. See the examples.

      If you mean: how can I get a wrapper javascript outside your C++ application to call C++ declared inside the WASM, ... Did you look in the qtloader.js generated by the emscripten compiler? You could try but I don't think that's the intention.

      From what I understand, I don't think Qt for WASM is intended as a way to speed up a JavaScript client with some extra C++. It's suppose to be a running application with UI in the browser.

      If I misunderstood the question, sorry.

      1 Reply Last reply
      1
      • lorn.potterL Offline
        lorn.potterL Offline
        lorn.potter
        wrote on last edited by lorn.potter
        #3

        It is possible to call c/c++ functions from javascript as well as call javascript from c/c++.
        Look at
        https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html

        Freelance Software Engineer, Platform Maintainer QtWebAssembly, Maintainer QtSensors
        Author, Hands-On Mobile and Embedded Development with Qt 5 http://bit.ly/HandsOnMobileEmbedded

        1 Reply Last reply
        2

        • Login

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