crt: Implement at_quick_exit()

The declaration of at_quick_exit() was added in
7dda261ef062073eed4ed5b46effa3edd4a658fc. However it is not exported
from any DLL, so we have to implement it ourselves.

This uses _crt_at_quick_exit to register functions to call if called
from an EXE, but does nothing if called from a DLL. In a DLL, we can't
unregister the callbacks if the DLL gets unloaded. This also matches
actual observed behaviour when using at_quick_exit from a DLL
when built with MSVC with the -MD option.

Signed-off-by: Martin Storsjö <martin@martin.st>
1 file changed