The LMX_AtExit function registers functions that are to be called at program termination.
...
On failure, this function returns an error code in the format described in Return codes.If function pointer value is NULL, the function will return LMX_INVALID_PARAMETER.
Remarks
LMX_AtExit is used to register cleanup functions that access LMX API.
Note: Calling static object destructors that interact with LM-X API, for example cstdlibCstdlib's atexit(), WinApi's_onexit(), is and static object destructors are not supported, and will have —using them will result in undefined behavior.