I'm trying to access Systemverilog associative array from C using VPI. I can access the array element for a key using the following code if I provide an existing key.
index = vpi_handle_by_index(reg_array, 200); // 200 is a valid key
vpi_value.format = vpiIntVal;
vpi_get_value(index, &vpi_value);
But this code generates an ERROR message if key is not valid (non-existing). How can I check if a key exists in the array without generating an ERROR message?