开发者

If I Develop a C++ (native) DLL with VS2010 will I need MSVCRT100.dll to be also deployed?

开发者 https://www.devze.com 2022-12-16 09:27 出处:网络
I\'m not using any features of the MSVCRT100.dll (I don\'t even know if there are new feature开发者_开发问答s).Well, you should be able to statically link it. Your .dll will be way bigger, but would n

I'm not using any features of the MSVCRT100.dll (I don't even know if there are new feature开发者_开发问答s).


Well, you should be able to statically link it. Your .dll will be way bigger, but would not require msvcrt. This is controlled by Code Generation->Runtime library (choose /MT).


Most applications use the C/C++ Runtimes. You may be using the runtime in a fashion you don't know of yet ... call fopen() somewhere? Then you use it.

However, as it pointed out by BarsMonster, you can link statically to the runtime. Your binary size grows, but you have no external dependencies. In fact this is the method you would choose if don't want to use installer software to deploy your application.

It's almost certainly the best choice for stuff like external libraries that are not bound to a particular application and could be reused several times. If you release your DLL to somebody in a SDK, i'd recommend providing lib's and dll's for both static and dynamic linkage to the runtime.

Keep in mind, however, that static linkage has one serious disadvantage: heap memory is not shared across DLL boundaries then. A memory block must be freed by the module (DLL) which allocated it i the first place. If you can't fulfil this requirement, do not use static linkage. Deploying with the runtime can't be avoided then.


You can use VS2010 and still target older versions of the runtime. This can be configured in your project properties, here's an image:

pic from VC++ blog http://blogs.msdn.com/photos/vcblog/images/9934271/original.aspx

Obviously you still need the toolset you're targeting installed.
For more info you can look at this VC++ team blog post.


Unfortunately, yes. You'll need the VC10 runtime for your platform (x86) or (x64) -- keep in mind though the runtime may change, though it is highly unlikely since VStudio has been in it's final phases for a while now.

It is the core runtime library, you can find out more of your dependencies using DependencyWalker (http://www.dependencywalker.com)

Or alternatively, try it :-)

0

精彩评论

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

关注公众号