Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 812 Bytes

how_to_debug_c_api_issues.md

File metadata and controls

14 lines (10 loc) · 812 Bytes

How to Debug C API Issues

C API provides exception handling, here are all possible return values of the functions:

typedef enum {
OK = 0,
/*
* @brief map exception to C++ interface
*/
GENERAL_ERROR = -1,
NOT_IMPLEMENTED = -2,
NETWORK_NOT_LOADED = -3,
PARAMETER_MISMATCH = -4,
NOT_FOUND = -5,
OUT_OF_BOUNDS = -6,
/*
* @brief exception not of std::exception derived type was thrown
*/
UNEXPECTED = -7,
REQUEST_BUSY = -8,
RESULT_NOT_READY = -9,
NOT_ALLOCATED = -10,
INFER_NOT_STARTED = -11,
NETWORK_NOT_READ = -12,
INFER_CANCELLED = -13,
/*
* @brief exception in C wrapper
*/
INVALID_C_PARAM = -14,
UNKNOWN_C_ERROR = -15,
NOT_IMPLEMENT_C_METHOD = -16,
UNKNOW_EXCEPTION = -17,
} ov_status_e;

There are two main types of possible issues:

  • parameter checking issue: return value is -14, check the input parameters
  • C++ call exception issue: if C++ called by C interface throw exception, C interface will catch the exception but no throw to C user, just returns the status value, without a detailed message. If you want details, can print it in exception macro.

See also