test/loader/loaded.rad 513 B raw
1
//! A package executed by both hosted compilation and the kernel loader.
2
3
/// Counter owned by each package instance.
4
static counter: i64 = 1;
5
/// Relocated slice pointing into this instance's initialized data.
6
static factor: *[u8] = "6";
7
8
/// Compute a result through a package-local call.
9
fn calculate(value: i64) -> i64 {
10
    set counter += value * (factor[0] as i64 - 48);
11
    return counter;
12
}
13
14
/// Return the result checked by both execution paths.
15
@default fn main() -> i32 { return calculate(7) as i32; }