From 6ba8a678a66d2bbf53e130438d948d4f5e05cc38 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 10 Apr 2020 11:32:19 -0700 Subject: [PATCH] Include BaseTsd.h to get SSIZE_T --- gen/include.rs | 6 ++++++ gen/write.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/gen/include.rs b/gen/include.rs index e3a9dd790..8f38fe385 100644 --- a/gen/include.rs +++ b/gen/include.rs @@ -38,6 +38,7 @@ pub struct Includes { pub string: bool, pub type_traits: bool, pub utility: bool, + pub base_tsd: bool, } impl Includes { @@ -88,6 +89,11 @@ impl Display for Includes { if self.utility { writeln!(f, "#include ")?; } + if self.base_tsd { + writeln!(f, "#if defined(_WIN32)")?; + writeln!(f, "#include ")?; + writeln!(f, "#endif")?; + } if *self != Self::default() { writeln!(f)?; } diff --git a/gen/write.rs b/gen/write.rs index 9d6ef6e45..d80e95795 100644 --- a/gen/write.rs +++ b/gen/write.rs @@ -126,6 +126,7 @@ fn write_include_cxxbridge(out: &mut OutFile, apis: &[Api], types: &Types) { needs_rust_fn = true; } ty if ty == Isize => { + out.include.base_tsd = true; needs_rust_isize = true; } ty if ty == RustString => {