emscripten-core / emscripten-core/emscripten

Custom EM_FUNC_SIG : is it possible ?

Open
#17,904 2 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

Hi,

I tried to create a new sig for '**emscripten_sync_run_in_main_runtime_thread**' _(i am using Pthreads.)_
Adding a float at the end of arguments instead of the int, already defined in threading.h like this (EM_FUNC_SIG_VIIIIII)

```cpp
#define EM_FUNC_SIG_VIIIIIF (EM_FUNC_SIG_RETURN_VALUE_V | EM_FUNC_SIG_WITH_N_PARAMETERS(6) | EM_FUNC_SIG_SET_PARAM(0, EM_FUNC_SIG_PARAM_I) | EM_FUNC_SIG_SET_PARAM(1, EM_FUNC_SIG_PARAM_I) | EM_FUNC_SIG_SET_PARAM(2, EM_FUNC_SIG_PARAM_I) | EM_FUNC_SIG_SET_PARAM(3, EM_FUNC_SIG_PARAM_I) | EM_FUNC_SIG_SET_PARAM(4, EM_FUNC_SIG_PARAM_I) | EM_FUNC_SIG_SET_PARAM(5, EM_FUNC_SIG_PARAM_F))
```

I called it like this.

```cpp
void func(int a,int b, int c, int d, int e, float f)
{
std::cout << "func" << std::endl;
}
...

std::thread t3([](){
emscripten_sync_run_in_main_runtime_thread(EM_FUNC_SIG_VIIIIIF, func,1,2,3,4,5,1.0f);
});
```

And i get this error. Am i doing something wrong ?

Current Version : 3.1.9

![runtime](https://user-images.githubusercontent.com/43699856/191468867-11355a5d-b9e9-465b-a97c-1cc7bdaae09f.PNG)

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.