-
Notifications
You must be signed in to change notification settings - Fork 493
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
Feature request: Make syn, quote and proc-macro2 optional when implementing COM interfaces. #2289
Comments
Yes, this is something I'd love to fix. |
Thanks for the reply. A short ping once something is available for testing would be great! It's not time critical in any way. |
I'm working on the eventual replacement for the |
Using the interface macro had the following problems for us:
// With the macro we had to expose this API:
pub unsafe fn CreateStatusArray(
&self,
capacity: u32,
name: PCSTR,
riid: *const GUID,
ppv: *mut *mut c_void,
) -> HRESULT;
// But we wanted to have this API:
pub unsafe fn CreateStatusArray<T>(&self, capacity: u32, name: PCSTR) -> Result<T>
where
T: Interface,
{...} The argument that users might not want to pull in syn, quote and proc-macro2 for better build times still applies. |
Thank! That's very helpful.
|
Just checking in with this older issue. I don't really see a practical solution for removing the |
(I'm subscribed to this issue even though I don't recall needing this, but chiming in anyway since it relates to what we found/discussed in #2694 (comment))
Since the split to windows-rs/crates/libs/core/src/unknown.rs Lines 86 to 88 in 1a2a992
But (as per the comment linked above) is no longer also including the proc-macro crates, that only happens in the main windows-rs/crates/libs/core/Cargo.toml Line 23 in 1a2a992
windows-rs/crates/libs/windows/Cargo.toml Line 30 in 1a2a992
That should solve your dependency question. It however seems (from the |
Hi! I haven't been keeping track with the changes that happened between 0.42 and 0.51, so I can't comment about changes on the old requirements right now. I have also delayed the update of the direct storage crate to wait until the development in the upstream project stablized and it seems now a good point to pull the changes from the current 1.2.1 version. I just realized that they now provide a "Microsoft.Direct3D.DirectStorage.winmd" metadata file, so most likely I shouldn't write the bindings manually anymore and should automatically generate them now. |
Definitely, that makes total sense with the https://github.com/Traverse-Research/amd-ext-d3d-rs In short you have to create a Hope that helps! |
On a somewhat related note, there appear to be 3 of these crates, 2 of which are from @damyanp / @kennykerr and have been yanked, but crates.io shows those two at the top 😅 |
The folks working on those APIs are using Anyway, I'll close this issue. If there's anything else you need help with, please create a new issue. |
Motivation
While porting the DirectStorage API to Rust we only used the interface proc macro as a starting point and the customized the expanded code to have more control of the generated API and provide a better user experience of the crate. This works in general fine, but the
IUnknown_Vtbl:::new()
function is behind theinterface
orimplement
feature, which pulls in some depdencies that the end user might now want to include (since they are not used by us).It would be good to somehow enable external crates to implement COM objects without the need to pull in the proc macro dependencies.
Drawbacks
No response
Rationale and alternatives
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: