If I create a std::function that contains a function in a library that I have dynamically loaded what should the behavior be if I first dynamically unload the library then let the std::function destructor run.
I ask as I have seen different behaviors on different platforms, running the destructor with no problems, throwing and exception and terminating. I'm not a fan of undefined behavior where it seems easily avoidable as in this case.
So are there strong reasons to favour one behaviour over another? Has anyone heard any discussion on this topic? I know the standard doesn't talk about dynamic loading much although there are a few papers such as http://ift.tt/1L6UV37 but they don't really address this issue.
Aucun commentaire:
Enregistrer un commentaire