emscripten-core / emscripten-core/emscripten

c++ virtual functions not working

Open
#16,333 18 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

I'm trying to use virtual functions with emscripten like the following :

```
IGameAssembly* asm = Application::GetGameAssembly();
auto scripts = asm ->GetScripts();

for (auto it : scripts)
{
std::cout << it << std::endl;
}
```

the above doesn't work when calling the class interface pointer
it gives an error like ```indirect call to null```
but if I do it like this it works :

```
WebGameAssembly* asm = (WebGameAssembly*)Application::GetGameAssembly();
auto scripts = asm->GetScripts();

for (auto it : scripts)
{
std::cout << it << std::endl;
}
```

any idea on how I can debug this ?

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.