Guide

Errors

Every call returns a status, a count or a pointer:

Returns On failure
a status anything other than AY2D_STATUS_OK
a count 0
a pointer NULL
an index -1

A failed call changes nothing. ay2d_last_error() says why the last call on your thread failed. Check the status first; the message is for logs.

Status Meaning
OK done
NULL a required pointer was null
BAD_MODEL the bytes were not a model, or a JSON file would not read
RANGE an index past the end, or a time, speed or wind that is not a real number
TOO_SMALL your output array is shorter than it needs to be
INTERNAL something failed inside; please report it with the message
BUSY another thread is in a call that drives this model (Threads)

A crash inside the library never reaches your program. It is caught at the boundary and reported as INTERNAL.