Skip to content

Commit

Permalink
Fix argument types in expansion of bytecode-callable functions (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
tizoc committed Aug 27, 2023
1 parent 1980c8b commit aa58239
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1540,13 +1540,13 @@ macro_rules! expand_exported_byte_function {
@return { $($rtyp:tt)* }
} => {
#[no_mangle]
pub extern "C" fn $byte_name(argv: &[$crate::RawOCaml], argn: isize) -> $crate::expand_exported_function_return!($($rtyp)*) {
pub extern "C" fn $byte_name(argv: *mut $crate::RawOCaml, argn: std::os::raw::c_int) -> $crate::expand_exported_function_return!($($rtyp)*) {
let mut i = 0usize;
$(
let $arg = argv[i];
let $arg = unsafe { core::ptr::read(argv.add(i)) };
i += 1;
)+
debug_assert!(i == argn as usize);
debug_assert_eq!(i, argn as usize, "count of arguments read from argv matches argn");
$name($($arg),*)
}
};
Expand Down

0 comments on commit aa58239

Please sign in to comment.