mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
22 lines
498 B
Rust
22 lines
498 B
Rust
#![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();
|
|
}
|
|
}
|