Maintaining C++ code that uses MFC

  • (2 Pages)
  • +
  • 1
  • 2

23 Replies - 1930 Views - Last Post: 25 January 2016 - 09:06 AM

#16 NormR  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 644
  • View blog
  • Posts: 4,844
  • Joined: 25-December 13

Re: Maintaining C++ code that uses MFC

Posted 08 January 2016 - 06:29 AM

I'm not sure the benefits of taking the time to fully understand the implications of going into the code and mucking it up are worth it for 2 or 3 users. Giving them the 3 needed mfc dlls will be a lot easier.
When it happens that most users need the features provided by VS2015, I'll take the time to learn what needs to be done.

Thanks everyone for the input.

Norm
Was This Post Helpful? 0
  • +
  • -

#17 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5928
  • View blog
  • Posts: 20,272
  • Joined: 05-May 12

Re: Maintaining C++ code that uses MFC

Posted 08 January 2016 - 08:33 AM

I found the Steve Han source code for version 4.0.2. Where is the source code for version 4.0.4b?
Was This Post Helpful? 0
  • +
  • -

#18 NormR  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 644
  • View blog
  • Posts: 4,844
  • Joined: 25-December 13

Re: Maintaining C++ code that uses MFC

Posted 08 January 2016 - 09:05 AM

I have some of the current source code for EasyBridge here: https://sites.google...te/normsstuff1/
Version 4.0.3 was for VC++6 (original from Steve Han with my changes)
Version 4.0.4 is for VS2005 (with My changes
Version 4.0.5 is for VS2015 (current work in progress

I suppose the b suffix was added by a user for his testing. The image I posted was from a user with the side-by-side problem that prompted this thread.

This post has been edited by NormR: 08 January 2016 - 09:06 AM

Was This Post Helpful? 0
  • +
  • -

#19 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1270
  • View blog
  • Posts: 4,997
  • Joined: 09-June 09

Re: Maintaining C++ code that uses MFC

Posted 11 January 2016 - 01:37 PM

You can use Dependency Walker to view all of the library dependencies your application has.
Was This Post Helpful? 0
  • +
  • -

#20 NormR  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 644
  • View blog
  • Posts: 4,844
  • Joined: 25-December 13

Re: Maintaining C++ code that uses MFC

Posted 11 January 2016 - 01:50 PM

Thanks, I've used that.
My problem is using VS2015 to create a program that will execute on a Win10 system that does not have the dlls that come with VS2015. Looking at the Windows/System32 folder in a Win10 system I see dlls in the 110 series. I'd like to have VS2015 use those dlls for my program.

This post has been edited by NormR: 11 January 2016 - 01:50 PM

Was This Post Helpful? 0
  • +
  • -

#21 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5928
  • View blog
  • Posts: 20,272
  • Joined: 05-May 12

Re: Maintaining C++ code that uses MFC

Posted 25 January 2016 - 07:56 AM

The main issue with the code base was that it implemented MFC Extension classes. MFC assumes that if you are extending a built in MFC class, you intend to redistribute in and therefore you must put your code into a DLL. The sad part here is that setting up MFC to statically link into a DLL is not supported. (There are many reasons why I hate MFC and this is added a new reason for me.)

Anyway, what was required to get this to work is to port the entire code base to built as a single executable with MFC linked in statically. As scary as it may sound about how huge the resulting executable maybe, the release build actually comes in a svelt 3MB program with balanced size vs. speed optimization turned on. The trick was to use link time code generation to let the linker figure out what code was really being used and what could be combined. I haven't done a complete dump of the resulting file, but I'm guessing that a good part of that 3MB is also art assets, so pretty amazing actually.
Was This Post Helpful? 0
  • +
  • -

#22 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5928
  • View blog
  • Posts: 20,272
  • Joined: 05-May 12

Re: Maintaining C++ code that uses MFC

Posted 25 January 2016 - 08:01 AM

Code currently lives at: github.com/azureskydiver/EasyBridge 's develop branch.
Was This Post Helpful? 0
  • +
  • -

#23 NormR  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 644
  • View blog
  • Posts: 4,844
  • Joined: 25-December 13

Re: Maintaining C++ code that uses MFC

Posted 25 January 2016 - 08:08 AM

Quote

use link time code generation to let the linker figure out what code was really being used and what could be combined

Makes sense. I'd like to include that with the VS2005 IDE build I do. What option in the IDE do I set to get that?
Was This Post Helpful? 0
  • +
  • -

#24 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5928
  • View blog
  • Posts: 20,272
  • Joined: 05-May 12

Re: Maintaining C++ code that uses MFC

Posted 25 January 2016 - 09:06 AM

If your pull from the current develop branch you should get it for the Release builds.

But if you are working on other projects, the setting is named "Link Time Code Generation" -- a first for Microsoft to say what it means -- I know. :) Look under project settings, Linker, All Options. I think it is also available in one of the other tabs under Linker, but I almost always go to All Options. Be warned that linking takes even longer than before (for obvious reasons) with this option enabled.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2