Skip to content

Feature Request: MINIMAL_RUNTIME + MODULARIZE selective export of symbols #18814

@DavidPeicho

Description

@DavidPeicho

Version of emscripten/emsdk: 3.1.31

We had a big discussion in #17911 and I think it would be great to talk about that again. The current solution to export symbols on Module with MINIMAL_RUNTIME+MODULARIZE is to use EXPORT_ALL (added in the linked PR). However, this is also going to export internal library symbols, which is most likely not wanted.

Some of the ideas that were added in the PR:

  • Create a new EMSCRIPTEN_EXPORT macro
  • Create a new flag EXPORT_KEEPALIVE

From what I remember, EMSCRIPTEN_EXPORT required a patch to LLVM, so I would vote for the second solution. If I am correct, the solution would be to take all kept alive symbols and to append it to EXPORTED_FUNCTIONS. AFAIK, this should just work because EXPORTED_FUNCTIONS is used here:

contentText += `\nModule["${mangled}"] = ${mangled};`;

Am I correct? If you are happy with the idea, I can start implementing it, maybe with some guidelines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions