[][src]Function casperlabs_contract::ext_ffi::read_host_buffer

pub unsafe extern "C" fn read_host_buffer(
    dest_ptr: *mut u8,
    dest_size: usize,
    bytes_written: *mut usize
) -> i32

This function copies the contents of the current runtime buffer into the wasm memory, beginning at the provided offset. It is intended that this function be called after a call to a function that uses host buffer. It is up to the caller to ensure that the proper amount of memory is allocated for this write, otherwise data corruption in the wasm memory may occur due to this call overwriting some bytes unintentionally. The size of the data which will be written is stored on the host. The bytes which are written are those corresponding to the value returned by the called contract; it is up to the developer to know how to attempt to interpret those bytes.

Arguments

  • dest_ptr - pointer (offset in wasm memory) to the location where the host buffer should be written
  • dest_size - size of output buffer
  • bytes_written - a pointer to a value where amount of bytes written will be set