Skip to content

Missing calling conventions for the function pointers #153

@robbert-vdh

Description

@robbert-vdh

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 pointers bool(*foo)(int bar) in the CLAP API then need to be changed to bool(CLAP_ABI *foo)(int bar).

EDIT: Fixed some errors, I misremembered some things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions