Boost logo

Boost :

Subject: Re: [boost] [atomic] [release] possible linking problem with atomic
From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2013-01-10 23:15:25


[Edward Diener]
> In Visual Studio, easily the most popular Windows IDE, the VC++ modules
> all link by default to the DLL version of libraries ( RTL, MFC, ATL etc.
> etc. ). Of course you can change this but the default is DLLs, not
> static libs.

Amusingly, static linking is the default in a relatively trivial way - if you invoke the compiler from the command line and don't specifically select one of the four flavors, you get static release:

C:\Temp>type meow.cpp
#include <stdio.h>

int main() {
    #ifdef _DLL
        printf("Dynamic ");
    #else
        printf("Static ");
    #endif

    #ifdef _DEBUG
        puts("Debug");
    #else
        puts("Release");
    #endif
}

C:\Temp>cl /EHsc /nologo /W4 /MT meow.cpp && meow
meow.cpp
Static Release

C:\Temp>cl /EHsc /nologo /W4 /MTd meow.cpp && meow
meow.cpp
Static Debug

C:\Temp>cl /EHsc /nologo /W4 /MD meow.cpp && meow
meow.cpp
Dynamic Release

C:\Temp>cl /EHsc /nologo /W4 /MDd meow.cpp && meow
meow.cpp
Dynamic Debug

C:\Temp>cl /EHsc /nologo /W4 meow.cpp && meow
meow.cpp
Static Release

This is unrelated to the question of whether Boost libs should link statically or dynamically by default (as I recall, Boost.Regex defaults to static, but I haven't checked recently).

Stephan T. Lavavej
Visual C++ Libraries Developer


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk