You might also consider using emscripten's MAIN_MODULE/SIDE_MODULE dynamic
linking mechanism:
https://github.com/emscripten-core/emscripten/wiki/Linking

On Fri, Nov 19, 2021 at 9:58 PM Shlomi Fish <[email protected]> wrote:

> Hi!
>
> On Fri, 19 Nov 2021 17:02:48 -0800 (PST)
> Yixin Chen <[email protected]> wrote:
>
> > I know there is EM_JS methood to call A.wasm in the browser.
> >
> > My question is, is there any direct way to import A.wasm in B.wasm, just
> > like c++'s lib ?
> >
>
> Two ways I can think of:
>
> 1st way: using a JS bridge:
> ===========================
>
> ```
> window.bmethodwrapper = (x) => {return B.wasm.bmethod(x,...);};
> A.wasm.call('Amethod', window.bmethodwrapper);
> ```
>
> 2nd way: compiling both libraries into the same AandB.wasm:
> ===========================================================
>
> as an amalgamated source.
>
> --
>
> Shlomi Fish       https://www.shlomifish.org/
> List of Networking Clients - https://shlom.in/net-clients
>
> I before E, except after C. We live in a weird society.
>     — Source unknown, via Nadav Har’El.
>
> Please reply to list if it's a mailing list post - https://shlom.in/reply
> .
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/20211120075834.4df0655d%40shlomifish.org
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAL_va2_Ezk8%2BJvAg%3DtSuqxPt5t4W1LxM5jUmfn5GusdTWrxdKg%40mail.gmail.com.

Reply via email to