Skip to content

Commit 15c00b4

Browse files
committed
Windows long is always 4 bytes wide
1 parent 5da9019 commit 15c00b4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Diff for: rustler_sys/build.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ fn try_gen_api(dst: &Path, pointer_size: usize) -> bool {
2727
}
2828

2929
fn main() {
30-
// get size of C pointer
31-
let target_pointer_width = match env::var("CARGO_CFG_TARGET_POINTER_WIDTH") {
32-
Ok(ref val) if val == "32" => 4,
33-
Ok(ref val) if val == "64" => 8,
34-
Ok(ref val) => panic!("Unsupported target pointer width: {}", val),
35-
Err(err) => panic!(
30+
// get size of C long
31+
let long_width = match (env::var("CARGO_CFG_TARGET_POINTER_WIDTH"), env::var("CARGO_CFG_TARGET_OS")) {
32+
(_, Ok(ref os)) if os == "windows" => 4,
33+
(Ok(ref val), _) if val == "32" => 4,
34+
(Ok(ref val), _) if val == "64" => 8,
35+
(Ok(ref val), _) => panic!("Unsupported target pointer width: {}", val),
36+
(Err(err), _) => panic!(
3637
"An error occurred while determining the pointer width to compile `rustler_sys` for:\n\n{:?}\n\nPlease report a bug.",
3738
err
3839
),

0 commit comments

Comments
 (0)