fungos / cr

cr.h: A Simple C Hot Reload Header-only Library
https://fungos.github.io/cr-simple-c-hot-reload/
MIT License
1.54k stars 101 forks source link

Added MinGW32 SEH crash and assert protection #67

Closed clibequilibrium closed 2 years ago

clibequilibrium commented 2 years ago

This PR adds crash protection on MinGW32 . Please note since except is not supported on MinGW I had to use try1 and __except1 . The only problem with my solution is that there is no way for me to get the right error code so I just return CR_OTHER.

Also is returning -1 okay after try catch ? From my tests it introduced the correct behavior of rollback. Previously crash protection was not working at all for me. This PR tackles this issue.

Please note while this PR adds crash protection it doesn't add assertation protection yet.

EDIT: the PR has been updated to fully support assert and crash protection in MingW32 environment

fungos commented 2 years ago

Thanks for fixing this!