diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2024-01-26 01:26:09 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2024-01-26 01:26:09 +0100 |
| commit | 461126ce309f99e4ad2a6ddcbc175ea01c5e8fee (patch) | |
| tree | 30de8bcfec97f87d468191fb9959f90e7ee91100 /examples/rust/src/hello.rs | |
| parent | b9a4e8788f374dac94e4f3f5b062dbe2a1d2a10c (diff) | |
feat: full no_std support
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'examples/rust/src/hello.rs')
| -rw-r--r-- | examples/rust/src/hello.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/examples/rust/src/hello.rs b/examples/rust/src/hello.rs new file mode 100644 index 0000000..34f3c7f --- /dev/null +++ b/examples/rust/src/hello.rs @@ -0,0 +1,18 @@ +#![no_std] +#![no_main] + +#[cfg(not(test))] +#[panic_handler] +fn panic(_info: &core::panic::PanicInfo) -> ! { + core::arch::wasm32::unreachable() +} + +#[link(wasm_import_module = "env")] +extern "C" { + fn printi32(x: i32); +} + +#[no_mangle] +pub unsafe extern "C" fn add_and_print(lh: i32, rh: i32) { + printi32(lh + rh); +} |
