Honestly, it’s probably easier to fork a new process with the updated library, devise a fast serialization mechanism for your data, ship it from the old process to the new, then cutover to the new.
For some value of easy, of course.
If I remember correctly this is how xmonad handles configuration changes.
I’ve thought about using Cap’n Proto for that.
On the same topic - handmade hero live reloading of c++ game engine:
This was long, but I loved basically every moment, and the payoff at the end, where a library drawing into a graphical framebuffer gets hot reloaded every time a buildable program is saved to disk, is amazing. Be sure to check out the YouTube demo that shows more of what you can do there, if only by writing bytes into memory that represents color channels of a grid of pixels.
Everything was ruined when thread-local storage combined with destructors.