emscripten-core / emscripten-core/emscripten

Enable a runtime function without exporting it to Module

Open
#21,920 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hi! This one should be easy but I have not found an elegant way to solve it. Using emscripten v3.1.59.
I have a JS function which is called from C, this JS function uses the `stringToNewUTF8()` library function to return a string to the C program.
This JS function is added via `—pre-js` (also tried with `—post-js`).
Basically, I want the `stringToNewUTF8` function to be defined, but not exported to Module.
Using `-sEXPORTED_RUNTIME_METHODS=stringToNewUTF8` make things work but now I get `stringToNewUTF8` defined on Module, which is not useful.

What is the best way to do this?

Please let me know if you need additional information on this use case.

Thanks a lot for your help!

Kind regards,
Maurice

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.