Enable using dynamic runtime libs with when disabling shared libs for Windows
|Status:||Assigned||Start date:||10 Jan 2017|
|Assignee:||Robin Mills||% Done:|
|Category:||build||Estimated time:||2.00 hours|
This patch enables using dynamic runtime libraries when using NO_SHARED libraries with cmake instead of the staticly linked version. For use and tested in Windows with CMake / MSVC.
#2 Updated by Robin Mills 9 days ago
- % Done changed from 0 to 50
- Estimated time set to 2.00
Thanks for reporting this. We made a policy decision (in 2008) to support "all dlls, or all static". Mikayel asked for "dlls with static run-time". This is a lethal combination which I investigated and discussed in detail. http://dev.exiv2.org/issues/1157
The problem is that linking DLLs with static run-time can result in several copies of run-time library because every dll (eg libexiv2.dll contains a static run-time library) and the executable/client app have their own run-time library. If you open a FILE* in libexiv2.dll and fclose() it in the application, the application will crash. That typically does not happen, however memory resources (new/delete) often cross the library boundaries with very bad consequences.
I think static libraries that all use a shared dynamic runtime will work. Thanks for your patch. I'll review this.
#3 Updated by Ben Touchette 9 days ago
The patch was made to leave things the way they work as is, but gives the option of creating a static only lib that requires linking to dynamic runtimes a way to do so. Yes the whole app needs to be linked that way as well else it just won't link i would think :)