From 0bc41405ec883bb73caca24b6e7cd369e8642c22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Fri, 12 Feb 2021 12:50:19 +0300 Subject: [PATCH] Replace build.rs with link attributes --- build.rs | 14 -------------- src/windows.rs | 1 + 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 build.rs diff --git a/build.rs b/build.rs deleted file mode 100644 index 95f4b90b3..000000000 --- a/build.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![deny(warnings)] - -use std::env; - -fn main() { - let target = env::var("TARGET").expect("TARGET was not set"); - if target.contains("windows") { - // for BCryptGenRandom - println!("cargo:rustc-link-lib=bcrypt"); - } else if target.contains("apple-ios") { - // for SecRandomCopyBytes and kSecRandomDefault - println!("cargo:rustc-link-lib=framework=Security"); - } -} diff --git a/src/windows.rs b/src/windows.rs index 56b3d07e2..643badd07 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -11,6 +11,7 @@ use core::{ffi::c_void, num::NonZeroU32, ptr}; const BCRYPT_USE_SYSTEM_PREFERRED_RNG: u32 = 0x00000002; +#[link(name = "bcrypt")] extern "system" { fn BCryptGenRandom( hAlgorithm: *mut c_void,