You can do in a post-js

Module['wasmMemory'] = wasmMemory;

and then from JS that only has access to Module from the outside you can do
Module.wasmMemory.


On Fri, May 24, 2019 at 3:13 AM Stéphane Letz <[email protected]> wrote:

> I could indeed access the wasmMemory variable from an EM_ASM block
> compiled on C++ side. But I can not access for the JS side, like if is was
> not properly exported. How can that be done ? What is the --post-js code to
> add to do that?
>
> Thanks.
>
> Le jeudi 16 mai 2019 23:36:07 UTC+2, Alon Zakai a écrit :
>>
>> We removed undocumented automatic exporting like that for several
>> objects, as it is bad for code size if you don't need those exports.
>>
>> But wasmMemory still exists as a JS variable, so you can access it from
>> EM_JS/EM_ASM, --post-js, etc., and you can capture it there (and export it,
>> if you want).
>>
>> - Alon
>>
>>
>> On Thu, May 16, 2019 at 10:22 AM Stéphane Letz <[email protected]> wrote:
>>
>>> In a previous version of Emscripten, I was able to access the
>>> underlying WebAssembly memory by just using the Module['wasmMemory']
>>> field. This does not work anymore with code compiled using Emscripten
>>> with 1.38.30.
>>>
>>> Is there an official and reliable way to access the WebAssembly memory?
>>> I need that when giving a correctly built *importObject* argument in
>>> the *WebAssembly.Instance* function.
>>>
>>> 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].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/emscripten-discuss/bc4d31de-59fb-474c-9dd9-792aa3fe648d%40googlegroups.com
>>> <https://groups.google.com/d/msgid/emscripten-discuss/bc4d31de-59fb-474c-9dd9-792aa3fe648d%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/emscripten-discuss/9902a80d-7c60-4b02-812b-3ad95a5daa90%40googlegroups.com
> <https://groups.google.com/d/msgid/emscripten-discuss/9902a80d-7c60-4b02-812b-3ad95a5daa90%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpT-b%2BKriDkvg6Y5QSQw%3DhvFQU9hbJU1sfnm51dRWKz8HA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to