emscripten-core / emscripten-core/emscripten

Dynamic linking emscripten::val(..) fails in SIDE_MODULE

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

Description

emscripten 3.1.7

Error message: BindingError: emval::as has unknown type N10emscripten3valE

Using emscripten::val("some text") in a SIDE_MODULE fails under some circumstances. Other uses of emscripten::val work, just not the c'tor.

Fails:
emscripten::val rawPlatform = emscripten::val::global("navigator")["platform"];
if (rawPlatform.call("includes", emscripten::val("Mac")))

Succeeds:
emscripten::val rawPlatform = emscripten::val::global("navigator")["platform"];
if (rawPlatform.call("includes", std::string("Mac")))

Both work fine in non dynamic linking build, or if invoked from MAIN_MODULE.

I tried a simple example app, but it was not failing there. But fails in a big project - Qt.

Also, we use MODULARIZE and EXPORT_NAME

Any comments, hints, or suggestions welcome.

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.