-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning a pointer to a file in MEMFS to javascript #6858
Comments
How MEMFS stores in memory may depend on various things, see the |
Yes this is what I was looking for. Thanks! Is there a way to call |
You can add |
Thanks for your reply! I have problems making I added the following. Do not mind the escapes. It is copied from a cmake file:
The build yields this error and This is my js code invisible to emscripten. Every line works except for the _munmap:
|
This is a little tricky, because munmap is implemented in a combination of C (in libc) and JS (in FS, through the syscall ABI). Worse, on the C side a macro is used, pointing to |
Ahh okay thanks for the tip. That actually worked. |
I am trying to return a C string back to javscript that was read from MEMFS. My steps are:
C++
Read from MEMFS to char*
Return char*
Javascript
Call _free() on the pointer
Is there a way to directly return a pointer to the MEMFS memory location? Did not found it im emscripten.h. This way I could avoid the alloc/copy/free cycle.
The text was updated successfully, but these errors were encountered: