How does one handle fatal errors in shared libraries?
I am wondering because the GNU Multiprecision Library (GMP) provides no means to recover from errors like out-of-memory. Using longjmp() or throwing C++ exceptions would work, except that it leaves GMP in an inconsistent state as per https://gmplib.org/projects.html. Is there a way to unload GMP (or another shared library) and then reload it, to fix this problem?