1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // ignore-win32 dynamic_lib can read dllexported symbols only
12 // ignore-linux apparently dlsym doesn't work on program symbols?
13 // ignore-android apparently dlsym doesn't work on program symbols?
14 // ignore-freebsd apparently dlsym doesn't work on program symbols?
16 use std::unstable::dynamic_lib::DynamicLibrary;
18 #[no_mangle] pub extern "C" fn fun1() {}
19 #[no_mangle] extern "C" fn fun2() {}
22 #[no_mangle] pub extern "C" fn fun3() {}
25 #[no_mangle] pub extern "C" fn fun4() {}
28 #[no_mangle] pub fn fun5() {}
32 let a = DynamicLibrary::open(None).unwrap();
33 assert!(a.symbol::<int>("fun1").is_ok());
34 assert!(a.symbol::<int>("fun2").is_err());
35 assert!(a.symbol::<int>("fun3").is_err());
36 assert!(a.symbol::<int>("fun4").is_ok());
37 assert!(a.symbol::<int>("fun5").is_err());