File tree 3 files changed +34
-19
lines changed
src/test/run-make/extern-fn-reachable
3 files changed +34
-19
lines changed Original file line number Diff line number Diff line change
1
+ -include ../tools.mk
2
+
3
+ all :
4
+ $(RUSTC ) dylib.rs -o $(TMPDIR ) /libdylib.so
5
+ $(RUSTC ) main.rs
6
+ $(call RUN,main)
Original file line number Diff line number Diff line change
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.
4
+ //
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.
10
+
11
+ #![ crate_type = "dylib" ]
12
+ #![ allow( dead_code) ]
13
+
14
+ #[ no_mangle] pub extern "C" fn fun1 ( ) { }
15
+ #[ no_mangle] extern "C" fn fun2 ( ) { }
16
+
17
+ mod foo {
18
+ #[ no_mangle] pub extern "C" fn fun3 ( ) { }
19
+ }
20
+ pub mod bar {
21
+ #[ no_mangle] pub extern "C" fn fun4 ( ) { }
22
+ }
23
+
24
+ #[ no_mangle] pub fn fun5 ( ) { }
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
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?
15
-
16
11
use std:: unstable:: dynamic_lib:: DynamicLibrary ;
17
-
18
- #[ no_mangle] pub extern "C" fn fun1 ( ) { }
19
- #[ no_mangle] extern "C" fn fun2 ( ) { }
20
-
21
- mod foo {
22
- #[ no_mangle] pub extern "C" fn fun3 ( ) { }
23
- }
24
- pub mod bar {
25
- #[ no_mangle] pub extern "C" fn fun4 ( ) { }
26
- }
27
-
28
- #[ no_mangle] pub fn fun5 ( ) { }
12
+ use std:: os;
29
13
30
14
pub fn main ( ) {
31
15
unsafe {
32
- let a = DynamicLibrary :: open ( None ) . unwrap ( ) ;
16
+ let path = Path :: new ( "libdylib.so" ) ;
17
+ let a = DynamicLibrary :: open ( Some ( & path) ) . unwrap ( ) ;
33
18
assert ! ( a. symbol:: <int>( "fun1" ) . is_ok( ) ) ;
34
19
assert ! ( a. symbol:: <int>( "fun2" ) . is_err( ) ) ;
35
20
assert ! ( a. symbol:: <int>( "fun3" ) . is_err( ) ) ;
36
21
assert ! ( a. symbol:: <int>( "fun4" ) . is_ok( ) ) ;
37
- assert ! ( a. symbol:: <int>( "fun5" ) . is_err ( ) ) ;
22
+ assert ! ( a. symbol:: <int>( "fun5" ) . is_ok ( ) ) ;
38
23
}
39
24
}
You can’t perform that action at this time.
0 commit comments