From 0b9954a6eaef6316ab540b5cb1785a0ad40776b1 Mon Sep 17 00:00:00 2001 From: Arnav Singh Date: Tue, 9 May 2023 23:47:09 -0700 Subject: [PATCH] Fix definition of `c_bool` for non-MSVC targets. Fixes #53 Signed-off-by: Arnav Singh --- jemalloc-sys/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jemalloc-sys/src/lib.rs b/jemalloc-sys/src/lib.rs index 1344e27b9..58010afdc 100644 --- a/jemalloc-sys/src/lib.rs +++ b/jemalloc-sys/src/lib.rs @@ -50,7 +50,14 @@ #![deny(missing_docs, broken_intra_doc_links)] use libc::{c_char, c_int, c_uint, c_void, size_t}; + +// jemalloc uses `stdbool.h` to define `bool` for which the Rust equivalent is `bool`. +// However jemalloc also has its own `stdbool.h` that it uses when compiling with MSVC, +// and this header defines `bool` as `BOOL` which in turn is `int`. +#[cfg(target_env = "msvc")] type c_bool = c_int; +#[cfg(not(target_env = "msvc"))] +type c_bool = bool; /// Align the memory allocation to start at an address that is a /// multiple of `1 << la`.