Visual Studio: how to specify different runtime libraries for the linker? (/ MTd, MDd, etc.)

I am linking to several libraries in VS2008. If my linker knowledge is correct, MTd is for static linking, and MDd is for dynamic linking (for DLLs.) My goal is to statically link some libraries and dynamic links to others. Project options seem to have only one setting for all libraries in the linker input. How should I do it?

+3
source share
4 answers

After setting up your project, a reasonable default R Runtime Library will be provided, depending on how you respond to the prompts of the project wizard. You can check and change this (if necessary) as follows:

  • right-click the corresponding project in Solution Explorer, select Properties
  • see "Configuration Properties", "C / C ++", "Code Generation", "Runtime Library".

Other libraries may be linked, however, you want, you just specified the library for the link in Linker, Input, Additional Dependencies.

Even if you connect to the DLL, it will still have a .LIB file (from the correct form for the DLL) for resolving external links, unless you manually load the DLL and find the necessary function entry points.

, LIB, , CRT, , - .

+3

, . /MD vs/MT , . , (/MT), , DLL . DLL-, , , . , .

. , .lib. . /MD DLL.

+4

, , . .

, , .lib, ( ) .

3 MS

  • (.lib equivelant.. .o)
  • (.lib- loadlib/getproc)
  • manually load the dynamic library (loadlib / getprocaddress)
0
source

if you reference the lib that MT was previously created and you ask for MD where my problem seems.

vice versa.

I think I will have to load and rebuild the external dependencies, because now I caught the trick 22, when I choose MT, I got build errors for some part of my project / solution and when I select MD I get errors for the other part.

0
source

Source: https://habr.com/ru/post/1777521/


All Articles