use std::env; use std::path::PathBuf; fn main() { println!("cargo:rerun-if-changed=version.def"); // The proxy's PE export surface is part of its runtime contract. Feed an // explicit module-definition file to the MinGW linker instead of relying // solely on Rust symbol export attributes and linker retention heuristics. if env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") && env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("gnu") { let definition = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("version.def"); println!("cargo:rustc-link-arg={}", definition.display()); } }