Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata needs to report calling convention correctly #1133

Closed
kennykerr opened this issue Aug 25, 2022 · 8 comments · Fixed by #1201
Closed

Metadata needs to report calling convention correctly #1133

kennykerr opened this issue Aug 25, 2022 · 8 comments · Fixed by #1201
Assignees
Labels
rust Critical for Rust adoption

Comments

@kennykerr
Copy link
Contributor

Examples of discrepancies where there are no numbers in the .lib in the SDK

Those are likely because those functions aren't stdcall at all - many are likely cdecl. It would be most helpful if those are reported to the win32metadata repo since the metadata would need to indicate the calling convention before the Rust project can do anything about it.

As of now, we just assume all functions are stdcall since the metadata doesn't appear to set the CallingConvention field.

Originally posted by @kennykerr in microsoft/windows-rs#1985 (comment)

@kennykerr kennykerr changed the title > Examples of discrepancies where there are no numbers in the .lib in the SDK Metadata needs to report calling convention correctly Aug 25, 2022
@kennykerr
Copy link
Contributor Author

Examples include functions like DtcGetTransactionManagerExW and LdapGetLastError that are cdecl rather than stdcall. Currently the metadata doesn't appear to capture this information.

@kennykerr
Copy link
Contributor Author

I checked the latest CI build and it doesn't seem to capture anything to do with calling convention - still reports stdcall/winapi. Was hoping the ClangSharp update would have automagically fixed this. 😜

@sotteson1
Copy link
Contributor

I checked the latest CI build and it doesn't seem to capture anything to do with calling convention - still reports stdcall/winapi. Was hoping the ClangSharp update would have automagically fixed this. 😜

I just figured out I was feeding ClangSharp something that was forcing everything to be winapi. Now I'm properly seeing cdecl so I can add it to the metadata. One side effect is now methods/delegates previously reported as winapi are stdcall. If I see a stdcall should I report them as winapi, or use stdcall?

@sotteson1
Copy link
Contributor

I'm going to leave stdcall functions as winapi to reduce the noise.

@elachlan
Copy link
Contributor

Related: #1053

@kennykerr
Copy link
Contributor Author

I'm going to leave stdcall functions as winapi to reduce the noise.

I believe winapi implies stdcall.

@sotteson1
Copy link
Contributor

I'm going to leave stdcall functions as winapi to reduce the noise.

I believe winapi implies stdcall.

Right. It's weird the enum has both winapi and stdcall.

@kennykerr
Copy link
Contributor Author

Here are the options in ECMA335:

image

I suspect winapi maps to "CallConvPlatformapi" above and basically means the default calling convention for the platform, which is stdcall for Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Critical for Rust adoption
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants