开发者

How do I remove dependency on mfc80.dll and msvcr80.dll?

开发者 https://www.devze.com 2023-01-31 19:15 出处:网络
My code does not use MFC.However, when I built my static lib the party that is trying to开发者_C百科 use it is stating that they are having a hard time because my code lib has the following dependenci

My code does not use MFC. However, when I built my static lib the party that is trying to开发者_C百科 use it is stating that they are having a hard time because my code lib has the following dependencies in it:

mfc80.dll and msvcr80.dll

Is there a way to remove those and rebuild? I am using vs2008.


A static library by default links to the dynamic runtime, which is why your code has a dependency on msvcr80.dll. Visual C++ programs must link to a runtime. You can change your static library to use a static runtime to remove the dependency. This is done in the Configuration Properties | C/C++ | Code Generation | Runtime Library setting. However, the chosen runtime library must match what is used in the project that links your static library.

Your code probably depends on mfc80.dll because you have Configuration Properties | General | Use of MFC set to one of the MFC options.

In my opinion, Visual C++ (and Windows in general) was made for dynamic libraries and dynamic runtimes. Static libraries seem like more of a hack, in that they have a surprising number of limitations, pitfalls and idiosyncratic behavior. Better become familiar with producing and consuming dynamic libraries -- it's better in the long run.


mscvr80.dll is the release CRT. You can remove this dependency by setting the compiler to statically link. Most likely, you're trying to load MFC because the project is set to use MFC, even though you're not using it. You can remove this in the project settings.

Although, gotta question why VS2008 would produce mfc80.dll and mscvr80.dll dependencies, instead of mfc90.dll and mscvr90.dll.

0

精彩评论

暂无评论...
验证码 换一张
取 消