about summary refs log tree commit diff
path: root/src/libstd/dynamic_lib.rs
diff options
context:
space:
mode:
authorSébastien Marie <semarie@users.noreply.github.com>2015-01-29 08:19:28 +0100
committerSébastien Marie <semarie@users.noreply.github.com>2015-02-01 14:41:38 +0100
commitfcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae (patch)
tree055fbf1fe9f0b9bd89481f29105fef90370d7789 /src/libstd/dynamic_lib.rs
parentf1f9cb705df95171fce4e575374c959509e58dea (diff)
downloadrust-fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae.tar.gz
rust-fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae.zip
openbsd support
Diffstat (limited to 'src/libstd/dynamic_lib.rs')
-rw-r--r--src/libstd/dynamic_lib.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs
index f35f63143ef..458b0a46e8b 100644
--- a/src/libstd/dynamic_lib.rs
+++ b/src/libstd/dynamic_lib.rs
@@ -1,4 +1,4 @@
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -173,7 +173,8 @@ mod test {
     #[cfg(any(target_os = "linux",
               target_os = "macos",
               target_os = "freebsd",
-              target_os = "dragonfly"))]
+              target_os = "dragonfly",
+              target_os = "openbsd"))]
     fn test_errors_do_not_crash() {
         // Open /dev/null as a library to get an error, and make sure
         // that only causes an error, and not a crash.
@@ -190,7 +191,8 @@ mod test {
           target_os = "macos",
           target_os = "ios",
           target_os = "freebsd",
-          target_os = "dragonfly"))]
+          target_os = "dragonfly",
+          target_os = "openbsd"))]
 mod dl {
     use prelude::v1::*;
 
@@ -254,6 +256,7 @@ mod dl {
         dlclose(handle as *mut libc::c_void); ()
     }
 
+    #[cfg(not(target_os = "openbsd"))]
     #[link_name = "dl"]
     extern {
         fn dlopen(filename: *const libc::c_char,
@@ -263,6 +266,16 @@ mod dl {
                  symbol: *const libc::c_char) -> *mut libc::c_void;
         fn dlclose(handle: *mut libc::c_void) -> libc::c_int;
     }
+
+    #[cfg(target_os = "openbsd")]
+    extern {
+        fn dlopen(filename: *const libc::c_char,
+                  flag: libc::c_int) -> *mut libc::c_void;
+        fn dlerror() -> *mut libc::c_char;
+        fn dlsym(handle: *mut libc::c_void,
+                 symbol: *const libc::c_char) -> *mut libc::c_void;
+        fn dlclose(handle: *mut libc::c_void) -> libc::c_int;
+    }
 }
 
 #[cfg(target_os = "windows")]