当前位置: 动力学知识库 > 问答 > 编程问答 >

linker - Is it possible to mix static, multi-threaded, DLL libraries in one project?

问题描述:

Is it possible to use distinct libraries A, B, C in the same project in Visual Studio, where A is a static library, B is multi-threaded and C is a multi-threaded DLL? Or do they all have to be the same type for a single .exe output?

Edit: Sorry, A is a single-threaded static library. B is a multi-threaded static library, C is a multi-threaded DLL. (I guess A and B are the same from the linker's point of view?)

网友答案:

Are you talking about libraries compiler with different CRT linking type(static, dll)? If yes, then it's impossible.

网友答案:

Not sure what B is but the general idea is yes.

A will get compiled directly into the exe B Not sure about what this one is C Yes, functions within this library will be linked at runtime.

网友答案:

You can freely mix static and dynamic libraries, so long as they all use the same run-time libs.

In Properties -> General -> Configuration Type -> set this to Static Library or Dynamic Library for the libraries A and B you want to static or dynamic.

In Properties -> C/C++ -> Code Generation -> Runtime Library -> Every library which will be linked together must use the same run-time library, for example Multi-Threaded Debug DLL.

Thus you could do:
A - Config Type: Static Library. Runtime Lib: Multi-threaded Debug DLL. (yes this is ok)
B - Config Type: Dynamic Library. Runtime Lib: Multi-threaded Debug DLL

These two libs could be linked into the same exe.

分享给朋友:
您可能感兴趣的文章:
随机阅读: