rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.12k stars 430 forks source link

Problems with rttr::library to implement dll hot reload #280

Open deleoDev91 opened 4 years ago

deleoDev91 commented 4 years ago

Hello acki-m, first of all, great work with this library, it works really well and covers lots of amazing features.

Now to the point. I'm trying to implement a dll hot reload mechanism (guess my OS), and I'm using your rttr::library class for such end. But when I'm going to unload my dlls rttr says that cant unload it because when I create the library instace, it says that the library isnt loaded(m_is_loaded=false). The wierd thing is that i call is_loaded() method and says that the library is loaded.

For this strange behavior i find 2 solutions: 1- Keep a copy of the library instance stored in an array (std::vector) when loading dlls, and when unloading dlls, use this copy 2- Inpecting rttr::library code i found that m_is_loaded member doesnt match is_loaded() value, so modify this code to match always (I'll try this option, cause I find the first one a dirty solution)

What do you think?