emscripten-core / emscripten-core/emscripten

Calling a JS function from C++ with Thread

Open
#19,308 3 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

JS: Creating such a callback function at the top of my codes on the JS side.

```
function cb_Logging(text, verbosity) {
console.log(text);
}
```

C++(main.cpp): Running..

```
EM_ASM({
cb_Logging("Test", "Test");
});
```

C++(main.cpp): Not Runnig!

```
std::thread thread([&]{
EM_ASM({
cb_Logging("Test", "Test");
});
});
thread.join();
```

Please help me. I've been dealing with this for days.

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.