Add #native

This commit is contained in:
2024-06-17 04:14:13 +05:00
parent c7708db06e
commit fddedb7828
7 changed files with 157 additions and 1 deletions
+4
View File
@@ -0,0 +1,4 @@
@ 0
push -1
#native native_test
+13
View File
@@ -0,0 +1,13 @@
// Build with
// rustc --crate-type cdylib native_test.rs -o native_test.so
// or
// rustc --crate-type cdylib native_test.rs -o native_test.dll
#[no_mangle]
unsafe extern "C" fn labashka(pop: extern fn() -> u16, push: extern fn(u16) -> i32, len: extern fn () -> usize, max: usize) -> u32 {
println!("At {}, there's {}.", len(), pop());
push(12);
println!("Maximum size is {}.", max);
return 0;
}