Skip to content

Translate-c on non i386 drops stdcall annotation #4287

Open
@JesseRMeyer

Description

@JesseRMeyer

Consider WNDPROC from WinUser.h:

typedef LRESULT (CALLBACK* WNDPROC)(HWND, UINT, WPARAM, LPARAM);

Where CALLBACK is defined as (context included):

#elif (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
#define CALLBACK    __stdcall

Yet translate-c generates:

pub const WNDPROC = ?fn (HWND, UINT, WPARAM, LPARAM) callconv(.C) LRESULT;

with a .C, not .Stdcall convention.

For those not in the know, the difference between the two calling conventions is whether or not the caller or callee is responsible for clearing the stack after the call concludes. Getting this mixed up can make for 'fun' debugging sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    translate-cC to Zig source translation feature (@cImport)upstreamAn issue with a third party project that Zig uses.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions