Hi I'm building embeddable Rust library for integrating it as a C library for other programming languages.
I'm stuck in designing error handling process from Rust code to C.
For example I need to return some structure from Rust code, and also I need to report an error, in C/C++ I can write something like this.
SomeType * someFunc() {
// do something smart
if (err) return NULL; // this is horrible, but we have to tell there is an error
}
How can I send an error from exported Rust function to FFI interface where I don't have standard Option
type of Rust, and also can't return a NULL?
Wanted to check is there a classic way to do this, or I need to hack around defined struct and add some error handling fields?
Thanks