Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the /DISALLOWLIB message mean in VC++ linker output?

Tags:

visual-c++

I'm in the process of tracking down a linker error with a VC++ 2005 application. When I switch on verbose linker output, I notice a ton of these messages:

Processed /DISALLOWLIB:nafxcwd.lib

What exactly does the /DISALLOWLIB switch mean?

like image 489
drewh Avatar asked Feb 02 '26 17:02

drewh


1 Answers

It stops certain libraries from being used in conjunction with other libraries. For example, the msvcrtd.lib library has an entry disallowing msvcrt.lib (since putting the debug and release versions of that library in the same executable will cause all sorts of problems).

I'm not sure it's actually a linker switch, though I've never tried it (it's not documented as such in any of the linker versions from the various Visual Studio releases). It is possible to insert:

#pragma comment(linker, "/disallowlib:somelib.lib")

in your source files so it's possible the linker may allow it as well. Where you do find it is within the libraries. If you execute:

dumpbin.exe /rawdata msvcrtd.lib

you'll see something like:

/disallowlib:libcmt.lib
/disallowlib:libcmtd.lib
/disallowlib:msvcrt.lib

in the output, meaning that the "command" is part of the library contents itself.

like image 153
paxdiablo Avatar answered Feb 04 '26 05:02

paxdiablo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!