1#![allow(non_upper_case_globals)]
8extern crate libc;
9use libc::{c_int, c_char};
10
11
12#[no_mangle]
14pub fn rust_fun_print_something() {
15 println!("something");
16}
17
18#[no_mangle]
19pub fn rust_fun_add_one(arg: i32) -> i32 {
20 arg + 1
21}
22
23#[no_mangle]
24pub extern "C" fn c_fun_print_something_else() {
25 println!("something else");
26}
27
28#[no_mangle]
29pub extern "C" fn c_fun_add_two(arg: c_int) -> c_int {
30 arg + 2
31}
32
33#[allow(unused_variables)]
34#[no_mangle]
35pub extern "C" fn c_fun_variadic(txt: * const c_char) {
36 }
38
39#[no_mangle]
41pub static mut rust_i32_mut: i32 = 42;
42#[no_mangle]
43pub static rust_i32: i32 = 43;
44
45#[no_mangle]
46pub static mut c_int_mut: c_int = 44;
47#[no_mangle]
48pub static c_int: c_int = 45;
49
50#[repr(C)]
51pub struct SomeData {
52 first: c_int,
53 second: c_int
54}
55
56#[no_mangle]
57pub static c_struct: SomeData = SomeData{first: 1, second: 2};
58
59#[no_mangle]
64pub static rust_str: &str = "Hello!";
65
66#[no_mangle]
67pub static c_const_char_ptr: [u8; 4] = [b'H', b'i', b'!', 0];
68
69
70
71
72
73