-
Notifications
You must be signed in to change notification settings - Fork 118
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
COM interfaces with thiscall methods are not represented correctly in metadata #1053
Comments
Are we able to tell from the headers or will we need to manually tag each method we come across? |
You should be able to tell from the header, but its kind of reversed, interfaces using stdcall are annotated in the headers, so you have to detect the lack of an annotation to differentiate. If thats hard you could also special case by interface name instead of special casing the interface methods maybe? |
In win32API, is there just thiscall and stdcall? I know there are a few more in https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.callingconvention?view=net-6.0 Is it safe to assume that if it isn't marked with stdcall that it would be thiscall and not one of the others? |
Yes, a (nonstatic) interface method in C/C++ which isn't annotated with a calling convention modifier should be thiscall by default. |
The RTF/richedit APIs have a few COM interfaces where some methods are thiscall instead of stdcall (i.e. the underlying IUnknown is using stdcall as usual, but the interface methods don't). Probably a historic mistake that couldn't been fixed due to compatibility so we're stuck with it. Using the interfaces with the wrong calling convention results in crashes.
The interfaces I came across while interop'ing with the RTF APIs are
ITextHost
andITextServices
intextserv.h
, not sure if there are more.The text was updated successfully, but these errors were encountered: