srajeshnkl
srajeshnkl

Reputation: 901

Use MFC in static Library

I have created my MFC Application with option "Use MFC in static Library".

I am creating installation for my application using Installshield. What are the dependency files or "Merge modules" should I add in the installshield?

Is it necessary to add " Microsoft C++ Runtime Library" or "Microsoft Visual C++ MFC" Merge modules?

Upvotes: 2

Views: 8508

Answers (3)

rohit.k.bankar
rohit.k.bankar

Reputation: 1

Many times we are facing issue of size of exe and dll is more than previous build. This can be resolved using project properties

Menu "Project" - Properties... Configuration Properties --->"Use of MFC Use MFC in static Library" and

In "C/C++ options"--> tab "Code Generation"-->choose "Multithreaded /MT" for static MFC.

if we choose above options then we do not need the VC2008 Redistributable installed on the PC and size of exe or dll is lesser

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55601

Static linking means the foo.lib was embedded in myapp.exe during the linker phase. No dependency on foo.dll exists and does not need to be redistributed. You should also understand that while static linking makes your deployment easier it's actually considered a security vunerability because if an exploit is found in foo.lib/foo.dll (MFC in this case) then Microsoft can't patch your application by updating the version in the WinSXS cache. It'll be up to you to include the latest redist on your build machine, rebuild and redeploy.

I highly suggest creating a virtual machine with a base snapshot that represents the oldest OS that you want to support and then testing your installer there. This will help identify missing dependencies that can then be resolved by using tools such as Dependency Walker, ILDasm/.NET Reflactor and ProcessMon.

Upvotes: 7

Jerry Coffin
Jerry Coffin

Reputation: 490518

At least if memory serves, no. If you use MFC in a static library, you're also required to link statically to the standard library as well. Unless you've added some other dependency on some other DLL, you should have a standalone executable.

You can/could check with dependency walker just to be sure, if you prefer.

Upvotes: 1

Related Questions