Skip to content
New issue

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

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

Already on GitHub? # to your account

Overloaded methods in COM have wrong vtable order #523

Closed
raphlinus opened this issue Nov 18, 2017 · 0 comments
Closed

Overloaded methods in COM have wrong vtable order #523

raphlinus opened this issue Nov 18, 2017 · 0 comments

Comments

@raphlinus
Copy link
Contributor

Apparently the COM-compatible ABI for overloaded methods is to group overloads together but put them in reverse order. I observed this in my use of DirectComposition APIs, but it seems to be pretty poorly documented. The best I could find is gcc bug 53398.

Note that Microsoft has published guidance discouraging overloads in COM-visible interfaces but seems to be ignoring this more recently. I believe this renders C bindings inoperable, but that's a separate question.

Also note the previous link suggests a naming scheme of MethodName MethodName_2 MethodName_3. I personally prefer this over the current scheme of MN1 MN2, especially for methods that end in a digit, for example IDCompositionArithmeticCompositeEffect::SetCoefficient1. Also note that the 1-based numbering is not consistently applied, for example the overloaded methods in dwrite_3.rs use a MN MN1 MN2 convention.

I'll prepare a patch that applies the MN MN_2 MN_3 convention because I think it's best, but am open to other alternatives. It seems unlikely that we'll be breaking many existing users.

raphlinus added a commit to raphlinus/winapi-rs that referenced this issue Nov 18, 2017
Puts overloaded COM methods in reverse order to follow MSVC ABI
convention. Also changes the naming convention to use an underscore
and a 1-based number for all overrides but the first, from the
current convention which is not consistent.

Tested with animations using the DirectComposition interfaces, which
are most of the changes. The main other cluster is font management
in DirectWrite.

Fixes retep998#523.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant