1#![no_std]
6
7use test_macro::plus_one;
12
13#[unsafe(no_mangle)]
14pub static kConstVarDefinedInRust: i32 = 17;
15
16#[unsafe(no_mangle)]
17pub static mut gVarDefinedInRust: i32 = 42;
18
19unsafe extern "C" {
20 static kConstVarExportedToRust: i32;
21 static mut gVarExportedToRust: i32;
22} #[unsafe(no_mangle)]
25pub extern "C" fn add_one_in_rust(x: i32) -> i32 {
26 plus_one!(x)
27}
28
29#[unsafe(no_mangle)]
30pub extern "C" fn get_const_var_exported_to_rust() -> i32 {
31 unsafe { kConstVarExportedToRust }
32}
33
34#[unsafe(no_mangle)]
35pub extern "C" fn fetch_add_var_exported_to_rust(x: i32) -> i32 {
36 unsafe {
37 let old = gVarExportedToRust;
38 gVarExportedToRust += x;
39 old
40 }
41}