2022-07-29 13:18:07 -05:00
|
|
|
#![cfg_attr(target_arch = "x86", feature(raw_dylib))]
|
2021-09-10 19:34:09 -05:00
|
|
|
|
|
|
|
#[link(name = "exporter", kind = "raw-dylib")]
|
|
|
|
extern {
|
|
|
|
#[link_ordinal(13)]
|
|
|
|
fn imported_function();
|
2022-08-02 13:36:41 -05:00
|
|
|
#[link_ordinal(5)]
|
|
|
|
static mut imported_variable: i32;
|
|
|
|
#[link_ordinal(9)]
|
|
|
|
fn print_imported_variable();
|
2021-09-10 19:34:09 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn library_function() {
|
|
|
|
unsafe {
|
|
|
|
imported_function();
|
2022-08-02 13:36:41 -05:00
|
|
|
imported_variable = 42;
|
|
|
|
print_imported_variable();
|
|
|
|
imported_variable = -42;
|
|
|
|
print_imported_variable();
|
2021-09-10 19:34:09 -05:00
|
|
|
}
|
|
|
|
}
|