fungos / cr

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

Incremental versioning could be incorrect #10

Closed novoselov-ab closed 6 years ago

novoselov-ab commented 6 years ago

While reading the code I think I found an issue, but I am not sure, apologize in advance in that case :)

It could happen that you loaded new version, failed, rollback happened. Later you again update the plugin, version increments and it will start to load on the same version as was already tried once. But since dll was once loaded VS will lock .dll/.pdb files and you won't be able to overwrite them. So it looks like it would be better to always try newer version (the one which was never ever loaded with LoadLibrary).

fungos commented 6 years ago

I believe I'd tested this case on a Visual Studio debugging session but I'm not sure as it was some time ago. I will let this issue open until I have the time to check it again.

Thank you for reviewing the code, btw!

fungos commented 6 years ago

Tried and could not reproduce, but also I did some fixes recently that may have fixed this.