次の方法で共有


Larger Foot Print of binaries generated by VS 2005 Compared to eVC 4.0

This information is courtsey of Trent Swanson who has been doing a lot of migration work around eVC to VS 2005 Native Code.

So you completed a migration to Visual Studio 2005 from Embedded Visual C++ and now you realized the binary footprint of your application is now 25% larger than that output from the eVC++ compiler.

Ok, so you want to reduce the size of the binary footprint of your application after migrating from embedded visual C++ to Visual Studio 2005. You just completed your migration and now you noticed the binary footprint of your application is 25% larger than that created by the eVC++ compiler. You have no need for C++ exception handling, because it never really existed in the previous version and/or you never got around to that KB that instructed you on linking RTTI in to your application. So now RTTI is there along with C++ SEH, you disable C++ SEH but that does not seem to do very much now what?

 

If you are using MFC you are going to first have to choose to dynamicaly link MFC, so in your project setting, general configuration properties you choose to use MFC in a Shared DLL, ohh... compiler error, maybe... so you set runtime library to /MD or /MDd depending on debug/release. Ok, good to go, almost there.

 

There seems to be a bug('issue') in Visual Studio 2005 for devices; although you choose to disable RTTI under the project configuration properties, C/C++, Language, Enable Run-Time Type Info property by setting it to "No (/GR-)" you will notice when you select the command line property it is still using /GR and not /GR- so you are going to have to add the /GR- to the additional command line properties if you want to disable RTTI and all that additional code that is emitted.

 

Outline of Steps

Dynamicaly Link MFC if you are using MFC

Disable C++ Exception Handling if you are not using it

Add the /GR- compiler switch to the C/C++ Command Line Options

Remove from Linker, Input, the depenencies for ccrtrtti.lib

 

And... Walla! Your binary footprint should be the same if not less than what it was when you compiled you mobile application with eVC++ now that you migrated and are compiling your application with Visual Studio 2005 for Devices.

 

-Trent (Migration) Swanson

Comments