fix generation of C signature when roc returns c_void

This commit is contained in:
Folkert 2023-02-25 16:05:09 +01:00
parent 35980e50b8
commit a3e759cc3c
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C

View file

@ -3972,13 +3972,17 @@ fn expose_function_to_host_help_c_abi_v2<'a, 'ctx, 'env>(
&param_types[..param_types.len().saturating_sub(1)],
)
}
(RocReturn::Return | RocReturn::ByPointer, CCReturn::Void) => {
(RocReturn::Return, CCReturn::Void) => {
// the roc function returns a unit value. like `{}` or `{ { {}, {} }, {} }`.
// In C, this is modelled as a function returning void
(&params[..], &param_types[..])
}
(RocReturn::ByPointer, CCReturn::Void) => {
// the roc function returns a unit value. like `{}` or `{ { {}, {} }, {} }`.
// In C, this is modelled as a function returning void
(
&params[..],
&param_types[..param_types.len().saturating_sub(1)],
// &param_types[..],
)
}
_ => (&params[..], &param_types[..]),