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

COM interface binding generation fails with HWNDs #3325

Closed
talagrand opened this issue Oct 15, 2024 · 7 comments
Closed

COM interface binding generation fails with HWNDs #3325

talagrand opened this issue Oct 15, 2024 · 7 comments
Labels
question Further information is requested

Comments

@talagrand
Copy link

talagrand commented Oct 15, 2024

Summary

This is a regression sometime between 0.48 and 0.58.

Given the following IDL file, compiled with midl + generated winmd, creating Rust bindings fails because the bindings refer to the HWND and HANDLE types which have not been imported or defined.

import "objidl.idl";

[ object, uuid(12345661-1223-1232-2233-134344444444), pointer_default(unique) ]
interface IAmAnInterface : IUnknown
{
    HRESULT PopWindow([in, unique] HWND parentWindow);
}

A minimal repro is attached. It requires nuget.exe in the path, available from nuget.org, and dotnet.exe (v.8) as well.

mydk.zip

Crate manifest

No response

Crate code

No response

@talagrand talagrand added the bug Something isn't working label Oct 15, 2024
@kennykerr
Copy link
Collaborator

Please attach the .winmd for the repro.

@talagrand
Copy link
Author

Attached
Stuff.Mydk.zip

@kennykerr
Copy link
Collaborator

Thanks, I believe I have this fixed in a working branch but I'll confirm with this repro.

@kennykerr
Copy link
Collaborator

Ah, I see the repro attempts to generate everything (neat!) but seems to assume that nuget.exe is available in the path, which is not the case on my dev box.

@kennykerr
Copy link
Collaborator

OK, found nuget.exe and can confirm the bindings are missing some external references. I think it should work if you remove this:

"--config",
"flatten",

Not sure why you're using those options but "flatten" doesn't quite do what it says - I've already fixed this in a development branch but will need a bit more time to stabilize. #3245

@kennykerr kennykerr added question Further information is requested and removed bug Something isn't working labels Oct 21, 2024
@kennykerr
Copy link
Collaborator

Sorry for the delay - I've been heads down on a major update to windows-bindgen. 😊

@talagrand
Copy link
Author

Thanks! I was able to migrate with this tip. I can't remember why I'd chosen flatten, maybe a misguided attempt to keep things simple.

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