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

Generate rust code/wrapper from (non-winrt) midl #1856

Closed
youyuanwu opened this issue Jun 27, 2022 · 3 comments
Closed

Generate rust code/wrapper from (non-winrt) midl #1856

youyuanwu opened this issue Jun 27, 2022 · 3 comments
Labels
question Further information is requested

Comments

@youyuanwu
Copy link

Hi team. I am from Azure ServiceFabric team and want to wrap our c sdk (idl based) to work well with windows-rs.

I followed https://github.com/kennykerr/component-rs to generate rust code from mdil but got error:

C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\shared\wtypesbase.idl(468) : error MIDL2003 : [msg]redefinition [context]: _FLAGGED_WORD_BLOB
  C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\um\unknwnbase.idl(42) : error MIDL2003 : [msg]redefinition [context]: IUnknown

I showed my idl file to @kennykerr and he pointed out that my idl is not winrt and I need a work around.

Quote from kenny:
"Looks like you're not building a WinRT component. While it should in theory work for COM components as well, I haven't yet tested that and may require you to choose a different set of command line options for MIDL. Also MIDL has no ability to create a winmd file for non-WinRT components. I plan to support that natively in Rust (without IDL) and that's what I'm actively working on now, but its not there yet.
There's a tool you can use to do that today (produce a winmd for COM APIs) - but requires some build.rs scripting - until native support arrives. Rafael should be able to help you out if you open an issue.
"

@kennykerr
Copy link
Collaborator

@riverar in case you have an example to point to.

@kennykerr kennykerr added the question Further information is requested label Jun 28, 2022
@riverar
Copy link
Collaborator

riverar commented Jun 29, 2022

Hi @youyuanwu 👋,

I'm still in the process of documenting this process, but this should get you started.
https://github.com/riverar/washington-rs

Email me if you have questions and I'll try to get to them.

Closing as duplicate of microsoft/win32metadata#998.

@LoganDark
Copy link

I'm still in the process of documenting this process, but this should get you started.
https://github.com/riverar/washington-rs

Is there anything we can just put in a build.rs? That manual code scares me, because if I adopted it then I'd have to maintain it and it looks like a mess.

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

4 participants