From 751971576e753c9d7b84c6252b39577ed3fa495c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?b=CA=B0edoh=E2=82=82=20sw=C3=A9?= Date: Wed, 19 Jun 2024 02:45:16 +0500 Subject: [PATCH] Fix function signature in #native... --- src/instructions/native.rs | 2 +- test/native_test.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/instructions/native.rs b/src/instructions/native.rs index 4b25462..20e7c11 100644 --- a/src/instructions/native.rs +++ b/src/instructions/native.rs @@ -42,7 +42,7 @@ pub fn native(stack: &mut Stack, arg: String) { let module = Library::new([libpref, arg, libsuf].join("")).unwrap(); // C libraries should use // void (*labashka)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size); - let func: Symbol u16, extern fn(u16) -> i32, extern fn () -> usize, usize)> = module.get(b"labashka").unwrap(); + let func: Symbol u16, extern fn(u16), extern fn() -> usize, usize)> = module.get(b"labashka").unwrap(); func(stack_pop_callback,stack_push_callback,stack_len_callback, stack.memory.size()); } } diff --git a/test/native_test.rs b/test/native_test.rs index ac41f88..a6061d6 100644 --- a/test/native_test.rs +++ b/test/native_test.rs @@ -4,7 +4,7 @@ // 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) { +unsafe extern "C" fn labashka(pop: extern fn() -> u16, push: extern fn(u16), len: extern fn () -> usize, max: usize) { println!("At {}, there's {}.", len(), pop()); push(12); println!("Maximum size is {}.", max);