about summary refs log tree commit diff
path: root/src/libstd/dynamic_lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-10-29 03:20:13 +0000
committerbors <bors@rust-lang.org>2015-10-29 03:20:13 +0000
commite8e6892e3cda5e3dc8408755d7a532ff74df869d (patch)
tree8eb1a4451545a0d40e4affe0eda8f4c75e319da2 /src/libstd/dynamic_lib.rs
parentb4af35f7b1dc30468a043dabd689365f4e518bda (diff)
parenta7d93c939a9cedbc239b3ce647fb8a22125a4d22 (diff)
downloadrust-e8e6892e3cda5e3dc8408755d7a532ff74df869d.tar.gz
rust-e8e6892e3cda5e3dc8408755d7a532ff74df869d.zip
Auto merge of #29289 - DiamondLovesYou:pnacl-std-crates, r=alexcrichton
Diffstat (limited to 'src/libstd/dynamic_lib.rs')
-rw-r--r--src/libstd/dynamic_lib.rs29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs
index 684a3005606..8583631ef58 100644
--- a/src/libstd/dynamic_lib.rs
+++ b/src/libstd/dynamic_lib.rs
@@ -120,7 +120,7 @@ impl DynamicLibrary {
     }
 }
 
-#[cfg(all(test, not(target_os = "ios")))]
+#[cfg(all(test, not(target_os = "ios"), not(target_os = "nacl")))]
 mod tests {
     use super::*;
     use prelude::v1::*;
@@ -374,3 +374,30 @@ mod dl {
         fn SetErrorMode(uMode: libc::c_uint) -> libc::c_uint;
     }
 }
+
+#[cfg(target_os = "nacl")]
+pub mod dl {
+    use ffi::OsStr;
+    use ptr;
+    use result::Result;
+    use result::Result::Err;
+    use libc;
+    use string::String;
+    use ops::FnOnce;
+    use option::Option;
+
+    pub fn open(_filename: Option<&OsStr>) -> Result<*mut u8, String> {
+        Err(format!("NaCl + Newlib doesn't impl loading shared objects"))
+    }
+
+    pub fn check_for_errors_in<T, F>(_f: F) -> Result<T, String>
+        where F: FnOnce() -> T,
+    {
+        Err(format!("NaCl doesn't support shared objects"))
+    }
+
+    pub unsafe fn symbol(_handle: *mut u8, _symbol: *const libc::c_char) -> *mut u8 {
+        ptr::null_mut()
+    }
+    pub unsafe fn close(_handle: *mut u8) { }
+}