about summary refs log tree commit diff
path: root/src/libstd/rand
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-01-21 15:36:25 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-02-11 11:12:32 -0800
commiteac0a8bc3070e45047fff57e7b024a059289a36d (patch)
treecbcaa9dc371f2b11fe2e9b9d3ee7a3f7a9cfdb8e /src/libstd/rand
parent4da4970767ae8fc2e3b6d0c280312bb0f4efeed6 (diff)
downloadrust-eac0a8bc3070e45047fff57e7b024a059289a36d.tar.gz
rust-eac0a8bc3070e45047fff57e7b024a059289a36d.zip
bootstrap: Add directives to not double-link libs
Have all Cargo-built crates pass `--cfg cargobuild` and then add appropriate
`#[cfg]` definitions to all crates to avoid linking anything if this is passed.
This should help allow libstd to compile with both the makefiles and with Cargo.
Diffstat (limited to 'src/libstd/rand')
-rw-r--r--src/libstd/rand/os.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs
index 8d92909faf5..8a422246514 100644
--- a/src/libstd/rand/os.rs
+++ b/src/libstd/rand/os.rs
@@ -269,7 +269,10 @@ mod imp {
     const kSecRandomDefault: *const SecRandom = ptr::null();
 
     #[link(name = "Security", kind = "framework")]
-    extern "C" {
+    #[cfg(not(cargobuild))]
+    extern {}
+
+    extern {
         fn SecRandomCopyBytes(rnd: *const SecRandom,
                               count: size_t, bytes: *mut u8) -> c_int;
     }