GNU Info

Info Node: (mikmod.info)Error Handling

(mikmod.info)Error Handling


Next: Library Initialization Prev: Type Definitions Up: Using the Library
Enter node , (file) or (file)node

Error Handling
==============

   Although MikMod does its best to do its work, there are times where
it can't.  For example, if you're trying to play a corrupted file,
well, it can't.

   A lot of MikMod functions return pointers or `BOOL' values. If the
pointer is `NULL' or the `BOOL' is 0 (false), an error has occurred.

   MikMod errors are returned in the variable `MikMod_errno'. Each
possible error has a symbolic error code, beginning with `MMERR_'. For
example, if MikMod can't open a file, `MikMod_errno' will receive the
value `MMERR_OPENING_FILE'.

   You can get an appropriate error message to display from the function
`MikMod_strerror'.

   There is a second error variable named `MikMod_critical'. As its name
suggests, it is only set if the error lets the library in an unstable
state.  This variable can only be set by the functions `MikMod_Init',
`MikMod_SetNumVoices' and `MikMod_EnableOutput'. If one of these
functions return an error and `MikMod_critical' is set, the library is
left in the uninitialized state (i.e. it was not initialized, or
`MikMod_Exit' was called).

   If you prefer, you can use a callback function to get notified of
errors. This function must be prototyped as `void MyFunction(void)'.
Then, call `MikMod_RegisterHandler' with your function as argument to
have it notified when an error occurs. There can only be one callback
function registered, but `MikMod_RegisterHandler' will return you the
previous handler, so you can chain handlers if you want to.


automatically generated by info2www version 1.2.2.9