#4978·windows-rs

windows-bindgen cannot resolve PerfLib functions or types

Author: sharpjsCreated Sep 21, 2026Updated Sep 22, 2026
Labelsquestion

Summary

After reading #4867 and other documentation for the windows-* crates, I attempted to use windows-bindgen 0.100.0 instead of windows 0.62.2 to test out the new regime. I find that, at least with the metadata shipped in windows-default, bindgen does not know about PerfLib.

The following build.rs:

rust
fn main() {
    let out_dir = std::env::var("OUT_DIR").unwrap();
    let bindings = format!("{out_dir}/bindings.rs");

    windows_bindgen::builder()
        .output(&bindings)
        .filters([
            "PerfQueryCounterInfo"
        ])
        .flat()
        .write();
}

...produces the following error:

error: failed to run custom build command for `myapp v0.1.0 (D:\MyApp)`

Caused by:
  process didn't exit successfully: `D:\MyApp\target\debug\build\myapp-2a73242b69d80234\build-script-build` (exit code: 101)
  --- stderr

  thread 'main' (22160) panicked at C:\Users\Me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\windows-bindgen-0.100.0\src\filter_parser.rs:163:21:
  type or namespace not found: `PerfQueryCounterInfo`
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

However, if I replace the filter string with "PdhOpenQueryW", the program builds.

Crate manifest

toml
[package]
name    = "myapp"
version = "0.1.0"
edition = "2024"

[dependencies]
windows-core = "0.100.0"

[build-dependencies]
windows-bindgen = "0.100.0"

Crate code

rust
fn main() { }