- 
                Notifications
    You must be signed in to change notification settings 
- Fork 167
Closed
Description
Repro:
test.cpp:
struct test {
    void (__stdcall* test_cb)(void);
};Command line (on arch linux): dotnet run -r ubuntu.18.04-x64 -f net5.0 -- -a -target i386-pc-win32 -n test -f test.cpp -o test.cs
Produced output:
namespace test
{
    public unsafe partial struct test
    {
        [NativeTypeName("void (*)() __attribute__((stdcall))")]
        public delegate* unmanaged[Cdecl]<void> test_cb;
    }
}Expected output:
namespace test
{
    public unsafe partial struct test
    {
        [NativeTypeName("void (*)() __attribute__((stdcall))")]
        public delegate* unmanaged[Stdcall]<void> test_cb;
    }
}(Notice the ignored calling convention)
I found a codepath where this information was discarded:
This clause unwraps AttributedType and calls the same function for attributedType.ModifiedType.
attributedType.Handle.FunctionTypeCallingConv is CXCallingConv_X86StdCall, but ModifiedType does not have this information and attributedType.ModifiedType.Handle.FunctionTypeCallingConv is CXCallingConv_C
win32metadata evades this by having Winapi as a default calling convention (--with-callconv *=Winapi) and seemingly all callbacks using this calling convention.
Metadata
Metadata
Assignees
Labels
No labels