Commit 5c63a71
Make embind work with -fvisibility=hidden (#22095)
Export emscripten::val and emscripten::memory_view in order to prevent
embind errors:
BindingError: _emval_take_value has unknown type
N10emscripten11memory_viewIhEE
Embind generates a numerical type id from the address of the
std::type_info object resulting from evaluating a typeid expressiion
(e.g. 'void *id = &typeid(T)').
However, C++ does not guarantee that this address is identical for all
evaluations of the typeid expression. In practice it is when using
static linking, but not when using dynamic linking when the libraries
are
built with the '-fvisibility=hidden' compiler option.
The non-identical id's then cause embind to decide that types have not
been registered when used from a library, since they have been
registered with a different id by the main wasm module.
Exporting the types in question makes typeid addresses identical again,
and fixes/works around the issue.
Co-authored-by: Morten Sørvig <[email protected]>1 parent 340aa0f commit 5c63a71
3 files changed
+33
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
430 | 431 | | |
431 | 432 | | |
432 | 433 | | |
433 | | - | |
| 434 | + | |
434 | 435 | | |
435 | 436 | | |
436 | 437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7717 | 7717 | | |
7718 | 7718 | | |
7719 | 7719 | | |
| 7720 | + | |
| 7721 | + | |
| 7722 | + | |
| 7723 | + | |
| 7724 | + | |
| 7725 | + | |
| 7726 | + | |
| 7727 | + | |
| 7728 | + | |
| 7729 | + | |
| 7730 | + | |
| 7731 | + | |
| 7732 | + | |
| 7733 | + | |
| 7734 | + | |
| 7735 | + | |
| 7736 | + | |
| 7737 | + | |
| 7738 | + | |
| 7739 | + | |
| 7740 | + | |
| 7741 | + | |
| 7742 | + | |
| 7743 | + | |
| 7744 | + | |
| 7745 | + | |
| 7746 | + | |
| 7747 | + | |
| 7748 | + | |
| 7749 | + | |
7720 | 7750 | | |
7721 | 7751 | | |
7722 | 7752 | | |
| |||
0 commit comments