Typedef TVMFFISafeCallType#
Defined in File c_api.h
Typedef Documentation#
-
typedef int (*TVMFFISafeCallType)(void *handle, const TVMFFIAny *args, int32_t num_args, TVMFFIAny *result)#
Type that defines C-style safe call convention.
Safe call explicitly catches exception on function boundary.
IMPORTANT: caller must initialize result->type_index to be kTVMFFINone, or any other value smaller than kTVMFFIStaticObjectBegin.
Possible return error of the API functions:
0: success
-1: error happens, can be retrieved by TVMFFIErrorMoveFromRaised
See also
TVMFFIErrorMoveFromRaised
See also
TVMFFIErrorSetRaised
See also
TVMFFIErrorSetRaisedFromCStr
See also
TVMFFIErrorSetRaisedFromCStrParts
Note
We decided to leverage TVMFFIErrorMoveFromRaised and TVMFFIErrorSetRaised for C function error propagation. This design choice, while introducing a dependency for TLS runtime, simplifies error propgation in chains of calls in compiler codegen. As we do not need to propagate error through argument but simply set them in the runtime environment.
- Param handle:
The function handle
- Param num_args:
Number of input arguments
- Param args:
The input arguments to the call.
- Param result:
Store output result.
- Return:
The call returns 0 if call is successful. It returns non-zero value if there is an error.