vtereshkov / umka-lang

Umka: a statically typed embeddable scripting language
BSD 2-Clause "Simplified" License
1.05k stars 53 forks source link

Umka API doesn't work well under Windows with MSVC #405

Closed skejeton closed 3 months ago

skejeton commented 3 months ago

If you use the umkaGetAPI function to get the Umka API vtable, any call performed on it will crash the program, even calls that don't require any parameters (ex. api->umkaGetVersion()). If you opt to use the DLL option, simple calls like umkaGetVersion() will work just fine, but calls that require Umka context will crash (ex. umkaAllocData(umka, size, free)) will crash it.

I suspect it's specific of how MSVC works, or the umka pointer is not actually valid (gotten from result)

Repository to reproduce this issue: https://github.com/skejeton/umka-dynimport

vtereshkov commented 3 months ago

@skejeton It should be

void *umka = result->ptrVal;

but not

void *umka = (void *)result;