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

Why is Abi hidden in the docs? #1375

Closed
estokes opened this issue Dec 6, 2021 · 3 comments
Closed

Why is Abi hidden in the docs? #1375

estokes opened this issue Dec 6, 2021 · 3 comments
Labels
question Further information is requested

Comments

@estokes
Copy link

estokes commented Dec 6, 2021

I'm a somewhat new user of this crate, and I've just finished using it to build an RTD server for Excel. One major thing that tripped me up during that process is that I had to extract the IDispatch interface for a callback object from a VARIANT that Excel passed me (the IRTDUpdateEvent object). In the union type of VARIANT_0_0_0 it's a RawPointer, and it took me quite a while, and a trip to the source code, to figure out that I needed to call Com::IDispatch::from_abi(ptr) in order to get a proper IDispatch interface from this RawPointer. So I guess I have two questions.

  • Am I doing something wrong? It does work, but maybe that's luck and I'm missing something huge. If I'm doing it wrong, then how am I supposed to get an IDispatch from a VARIANT?
  • If I'm not doing it wrong, then why hide from me that IDispatch implements Abi? If there is some good reason it must remain hidden, then maybe a helper function in VARIANT_0_0_0 that gets an IDispatch directly instead of a RawPointer?
@kennykerr
Copy link
Collaborator

The Abi trait is hidden as it is a low-level implementation detail needed for certain generic scenarios within the windows crate but should not be used directly. It's little more than a transmute though and I'd suggest you simply transmute yourself if you're casting from a pointer. The VARIANT struct is very difficult to use directly and really needs a hand-written wrapper. #539

@kennykerr kennykerr added the question Further information is requested label Dec 7, 2021
@estokes
Copy link
Author

estokes commented Dec 7, 2021 via email

@estokes
Copy link
Author

estokes commented Dec 7, 2021

In any case if you're planning to build a wrapper for VARIANT that solves my issue. Thanks!

@estokes estokes closed this as completed Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants