How to update MFC DLL's

Hi,
We're trying to deploy our Windows Mobile 5.0 MFC application to Smartphone devices, T-Mobile MDA-Pro and Cingular I-Mate, running Window Mobile 5.0. The installation goes fine and on launch of the application, the infamous, "... not for PocketPC", message box appears!! We tracked down the problem to \Windows\CPROG.EXE which links to \Windows\MFC80U.DLL and \Windows\MSVCRT80.DLL (version 8.0.50215.9). Using VS 2005's Remote Process Viewer, we were able to "terminate the process" and successfully launch our application. These files all have "Read-only", "System" and "ROM" file attributes.
Our application links to MFC DLL's dynamically so our package includes ATL80.DLL, MFC80U.DLL and MSVCRT80.DLL (version 8.0.50727.42) and installs them into the application installation directory. Our application uses basic MFC stuff, so, can't understand we are failing with the previous release of the MFC DLL's!!! BTW, we use MFC extension DLL's, so for now, going static linking is not an option.
Does anyone know how to update the MFC DLL's Anyone know the differences between the revisions
WD.


Answer this question

How to update MFC DLL's

  • mahendra_nath

    Two work arounds I could think of are

    1. Create your own custom MFC import library http://support.microsoft.com/kb/q131313/.

    This should point to a custom named MFC dll at run time. So dll loading will never be an issue with your app!

    high level steps to do it

    Use dumpbin /exports /out:mfc80u.def mfc80u.dll

    modify def file into the appropriate format. The library name in this def file identifies the dll

    Use lib /def:mfc80u.def to generate the new library.

    Copy mfc80u.def to the appropriate location for compilation

    Copy mfc80u.dll as a.dll to application directory on to the device

    2. Shadowing technique comes in handy in special cases where you are sure of the location of old dll in the ROM. When you try to over write an existing file in ROM by deployingthrough a CAB file, the CE OS will copy the new file to a different location but will load this new dll the next time it reboots.

    But the second approach will break the existing apps using the old MFC dll.

    Srikanth Bogadapati



  • Sha1-Hulud

    The prerelease version of MFC dlls should not be present on the device, this seems like T-Mobile/Cingular really need to address this with i-Mate. Unfortunately, Windows CE has an "interesting" memory model whereby it only loads one copy of a dll with a given name, and it completely ignores the location of the dll, so it will always go with first in memory wins, which means that either your app or cprog.exe will always fail. I don't know of a way to update the MFC dlls on these devices, I'm guessing an update from i-mate/Cingular/T-Mobile is necessary. Sorry I can't be more helpful,

    Jeff



  • twickl

    Hi,

    I just tried what you describe above but it doesn't work.

    My problem is that I have to link against mfcce400.lib as I only have that available but then on the device only the mfcce300.dll is available. So I tried you technique to produce the lib file from the mfcce300.dll. The problem is that the lib you generate is much smaller than it should be.

    if I try to produce a lib from the mfcce400.dll I get a file of 53 KB. The actual lib file is 850 KB! A lot of stuff is missing!

    Any idea

    Thanks,
    Giulio



  • How to update MFC DLL's