summaryrefslogtreecommitdiff
path: root/tests/run-make/raw-dylib-link-ordinal/lib.rs
blob: bb25ac64c613b261a64677e606ce60e6e11e7ecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]

#[link(name = "exporter", kind = "raw-dylib")]
extern {
    #[link_ordinal(13)]
    fn imported_function();
    #[link_ordinal(5)]
    static mut imported_variable: i32;
    #[link_ordinal(9)]
    fn print_imported_variable();
}

pub fn library_function() {
    unsafe {
        imported_function();
        imported_variable = 42;
        print_imported_variable();
        imported_variable = -42;
        print_imported_variable();
    }
}