emscripten-core / emscripten-core/emscripten

EM_JS and function pointers

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

Description

Our argument name parsing is too simple to support inline function pointer signatures
https://github.com/emscripten-core/emscripten/blob/1488c44c521c3d312028a81cf314ed6c8562b2c9/emscripten.py#L2449

```c++
EM_JS(void, fails, (int (f*)(int)), {...});

#define workaround_arg int (f*)(int)
EM_JS(void, workaround_A, (workaround_arg), {...});

typedef int (F_ii*)(int);
EM_JS(void, workaround_B, (F_ii f), {...});
```

The first one gets the wrong argument name, the second is clunky. Ideally this would just work, but would require either more clever parsing in emscripten.py, or tighter integration with Clang (possibly via a plugin?)

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.