Mike Trader
Mike Trader

Reputation: 8704

Removing msvcp90d.dll dependancy from Windows binary

I have a dll that I distribute that will not run on some windows OS. Using dependancy walker I discover msvcp90d.dll missing on these systems. I DO NOT want any run time dependancies that require the C++ redistributable, and since the application that calls the DLL is not written in C++, it does not have any dependancy on the C++ redistributable.

I am guessing the I left the DEBUG option in the linker preferences on when I compiled the dll which is why it needs msvcp90d.dll?

ADDED: Appologies, I pasted the wrong dll name in my original question.... too many hours in front of the monitor...

THe dll is a third party dll that I did not write compiled by me in VS2008.

Upvotes: 1

Views: 1092

Answers (3)

David Heffernan
David Heffernan

Reputation: 613572

Your options as I see them:

  1. Compile the DLL with the /MT option to use static linking to the C runtime.
  2. Continue with dynamic linking to the runtime, but distribute the C runtime with your app.

Upvotes: 2

Martyn Lovell
Martyn Lovell

Reputation: 2276

MSVCP90 is nothing to do with debug (that'd be msvcp90d). You can remove your dependency by switching the compiler to /MT (instead of /MD). You also need to ensure that every static library you link to was also compiled /MT.

I recommend against building apps /MT because it has a significant negative effect on system performance and makes servicing take longer in the event of a security issue with the CRT.

Finally, note that /MT means that your CRT is private. So you must ensure that CRT/STL types don't pass across your DLL boundary.

Martyn

Upvotes: 3

AJG85
AJG85

Reputation: 16217

It needs MSVCP90.dll because the dll was compiled with Visual Studio 2008 most likely. That is the release runtime. The short answer is if you don't want C++ runtime dependencies don't use C++ libraries or applications.

However you can do any of the following to solve your problem:

  1. Install the redistributable to the target system to satisfy the dependency
  2. Remove the dependency on that dll from your application
  3. Recompile the dll against the version of VC you prefer that is already present on the target system

Upvotes: 1

Related Questions