tags:

views:

391

answers:

3

Hello,

I wrote a dll in VS2008 that I use in my C# application,but my users don't like the fact they need both .NET framework and VC++ Runtime.

Is there a way I could avoid the 'must-have' VC++ Runtime in my C++ dll?

+3  A: 

You can link the static runtime library into your dll. This way it will always be there and no .dll with C++ runtime will be required.

sharptooth
How do i do that?
John
You can specify it in the settings of the project.
sharptooth
+9  A: 

You can build your dll with the runtime linked statically (/MT instead of /MD - Under properties->Configuration Properties->C/C++->Code Generation->Runtime Library).

Stefan
+1  A: 

Like others said, you can statically link, but that will become a nightmare if you ever incorporate 3rd party C++ dlls that are not statically linked (which is almost everything). That scenario will lead to random crashes that will take you forever to debug. The easiest thing to do is to use an installer which hides this from your users. You can use merge modules if you use the vs installer, or install as part of an nsis install. This will make everyone's life easier. Especially yours. There is no reason on should be against installing these anymore than one is against installing the .NET framework. It makes no difference in terms of stability unless you need them and don't have them.

Steve
I have only blowfish algorithm functions in the C++ dll,is that a nightmare?
John
no, but say you want to add another algorithm from a third part. Say Lapack. That will require the runtimes. Now, you have two separate linking models for the c runtimes in your appdomain. Each runtime implements its own way of doing things (especially allocation). See the MS recommendation here http://msdn.microsoft.com/en-us/library/aa278396(VS.60).aspx
Steve