Linking Your Application to the MFC for Windows CE Libraries

You can use MFC for Windows CE either as a statically linked library or as a dynamic-link library (DLL). When you use MFC as a statically linked library, the MFC code is included in your executable file the same way C functions are linked when you use a standard C library. When you use MFC as a DLL, the MFC library is loaded at run time, and the same DLL can be shared by multiple applications.

Using MFC as a shared DLL generates significantly smaller applications. In fact, a Windows CE-based application that is linked statically to MFC has two to ten times the code that it would if it were linked dynamically using the MFC DLL. When developing for Windows CE-based desktop platforms, if you use MFC as a DLL you must include the MFC DLL when you ship your application. Many Windows CE-based devices, however, include the MFC DLLs in ROM.

In the Microsoft Foundation Class library for desktop platforms, a single DLL contains both the core classes and the OLE support classes. In MFC for Windows CE, one DLL contains the OLE support classes, while another contains the core classes. This helps conserve memory resources. For example, if you are not using the OLE/ActiveX classes, they do not have to be loaded into memory. This flexibility also enables OEMs to support MFC for Windows CE either with or without the OLE/ActiveX classes.

MFC for Windows CE supports the following DLLs:

ActiveX controls must link dynamically with the core MFC and OLE DLLs that correspond to their Windows CE-based platform. If you are using the Windows CE MFC library as a shared DLL, your application also must link to the appropriate export library files.

To use the Windows CE MFC library as a shared DLL, your application must be linked with the DLLs and libraries shown in the following table.

DLL category Palm-size PC H/PC using H/PC Pro Edition software
MFC DLLs and Libraries Mfcce201(d).dll
Mfcce201(d).lib
Mfcs42(d).lib
Mfcce211(d).dll
Mfcce211(d). lib
Mfcs42(d).lib
OLE DLLs and Libraries Olecce201(d).dll
Olecce201(d). lib
Olecce211(d).dll
Olecce211(d). lib

The best way to ensure that your application or DLL is set up correctly for MFC is to use one of the WCE MFC AppWizards. These wizards automatically specify the compiler and linker settings that link your application to the appropriate MFC libraries. The AppWizards also include the appropriate ActiveX header files in your application, if required.

If you are creating an MFC application or DLL without using the MFC AppWizards, use the following procedures to set up your application correctly: