diff --git a/src/ffi.rs b/src/ffi.rs index a8ffd7442..418accced 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -436,6 +436,18 @@ impl ForeignFunctionTable { } libffi::raw::FFI_TYPE_SINT64 => read_and_push_int!(i64), libffi::raw::FFI_TYPE_POINTER => read_and_push_int!(i64), + libffi::raw::FFI_TYPE_FLOAT => { + field_ptr = field_ptr.add(field_ptr.align_offset(std::mem::align_of::())); + let n = std::ptr::read(field_ptr as *mut f32); + returns.push(Value::Float(f32::from(n).into())); + field_ptr = field_ptr.add(std::mem::size_of::()); + } + libffi::raw::FFI_TYPE_DOUBLE => { + field_ptr = field_ptr.add(field_ptr.align_offset(std::mem::align_of::())); + let n = std::ptr::read(field_ptr as *mut f64); + returns.push(Value::Float(f64::from(n))); + field_ptr = field_ptr.add(std::mem::size_of::()); + } libffi::raw::FFI_TYPE_STRUCT => { let substruct = struct_type.atom_fields[i].as_str(); let struct_type = self