Feature #1269

Enable using dynamic runtime libs with when disabling shared libs for Windows

Added by Ben Touchette about 1 month ago. Updated 9 days ago.

Status:AssignedStart date:10 Jan 2017
Priority:NormalDue date:
Assignee:Robin Mills% Done:


Category:buildEstimated time:2.00 hours
Target version:0.26


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.

msvc.diff Magnifier - Enable using dynamic runtime with static lib for windows (5.71 KB) Ben Touchette, 10 Jan 2017 19:04


#1 Updated by Robin Mills 16 days ago

  • Category set to build
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Target version set to 0.26

#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 :)

Also available in: Atom PDF

Redmine Appliance - Powered by TurnKey Linux