Closed robbert-vdh closed 1 year ago
I just realized that the __stdcall
versus __cdecl
story is only relevant for 32-bit Windows. But I'd still appreciate a CLAP_ABI
in CLAP nonetheless, as it's also required for Wine bridging to work. I'll submit a PR for this soon.
For reference, cdecl usage was also discussed in #21 (but nothing came out of it as the other changes were dropped)
After pulling my hair out trying to figure out why some plugins would initialize just fine when calling
clap_entry->init()
in this new Wine CLAP plugin bridge I've been working on while others don't, I finally realized that CLAP doesn't specify any calling conventions. Which means that on 32-bit Windows calling any CLAP functions is currently undefined behavior. This is mostly relevant on 32-bit Windows as 64-bit Windows uses a single calling convention, but having explicit calling conventions is still useful as there already are 32-bit Windows CLAP hosts and plugins. Wine these calling conventions are also mandatory when working with Winelib applications like I was.The fix for this would be to define something like a
CLAP_ABI
macro that's set to__cdecl
on Windows and and that's empty on other platforms. All function pointersbool(*foo)(int bar)
in the CLAP API then need to be changed tobool(CLAP_ABI *foo)(int bar)
.EDIT: Fixed some errors, I misremembered some things.