This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
[Experimental simulators] Improve C API exposed by qdk_sim_rs. #732
Open
Description
As suggested by @kuzminrobin, there's several opportunities available to improve c_api.rs
to better align with C API design guidelines and to offer a more robust interface from C callers into the Rust library:
- Add new
deallocate_string
function. To ensure that strings are allocated and deallocated in the same binary, C callers should be able to return ownership of strings back to Rust for deallocation. - Change
usize
tou64
. Sinceusize
is architecture-dependent, changing tou64
is more portable. - Granular return codes. Return codes from C API functions could be differentiated (as opposed to all
-1
) to allow for more granular reporting of errors to C-language callers.