Windows-rs: Import macro must support 3rd party dependencies

Created on 28 Apr 2020  路  5Comments  路  Source: microsoft/windows-rs

Dependencies include:

  • Specific Windows SDK (such as this package)
  • Specific WinRT component (such as Win2D)

Except for the SDK, WinRT components will include both metadata (winmd files) and executable binaries (DLL files) and most WinRT components are already distributed via nuget so perhaps the winrt::import macro needs to know how to unpack them directly.

enhancement

Most helpful comment

Talking with @kennykerr about this, this is our plan for action:

  • The import! macro will not do any network requests.

For nuget:

  • We'll add a nuget_dependencies key to the Cargo.toml manifest section.
  • Create a tool cargo-nuget which can read that section and store it in a well known place.
  • The import! macro can then read nuget dependencies from that well known place.

All 5 comments

Talking with @kennykerr about this, this is our plan for action:

  • The import! macro will not do any network requests.

For nuget:

  • We'll add a nuget_dependencies key to the Cargo.toml manifest section.
  • Create a tool cargo-nuget which can read that section and store it in a well known place.
  • The import! macro can then read nuget dependencies from that well known place.

Is it possible to import type for Microsoft.Update.Session?

@rylev @kennykerr it looks like the impl of this has changed since #118 was merged and this doesn't appear to be doc'd anywhere. Is there currently support for generating bindings for 3rd party winmd's? Trying to pull in Win2D.

You'll need to place the winmd files you wish to generate bindings for in the .windows/winmd folder. You'll also have to place the binaries in the .windows/[arch] folder (e.g. .windows/x64). In addition, you'll need to place the appropriate binaries from the Microsoft.VCRTForwarders.140 nuget package in that folder as well. From there, just include the desired namespaces/types in your windows::build! macro.

Checkout Kenny's Win2D sample as a guide.

I've added Win2D to the samples repo: https://github.com/kennykerr/samples-rs

Note that the windows crate first attempts to load metadata from the .windows/winmd folder, that Robert mentioned. Only if no winmd files are found will it fall back to the default metadata.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

13r0ck picture 13r0ck  路  4Comments

ctaggart picture ctaggart  路  4Comments

06393993 picture 06393993  路  3Comments

Susurrus picture Susurrus  路  3Comments

rylev picture rylev  路  4Comments