From a7d93c939a9cedbc239b3ce647fb8a22125a4d22 Mon Sep 17 00:00:00 2001 From: Richard Diamond Date: Sat, 24 Oct 2015 20:51:34 -0500 Subject: Port the standard crates to PNaCl/NaCl. --- src/libstd/dynamic_lib.rs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/libstd/dynamic_lib.rs') diff --git a/src/libstd/dynamic_lib.rs b/src/libstd/dynamic_lib.rs index 5629cba1e0b..8e942a116b1 100644 --- a/src/libstd/dynamic_lib.rs +++ b/src/libstd/dynamic_lib.rs @@ -118,7 +118,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::*; @@ -372,3 +372,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(_f: F) -> Result + 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) { } +} -- cgit 1.4.1-3-g733a5