VC++ : Extension Dlls

An MFC extension DLL has the following features and requirements:

1. The client executable must be an MFC application compiled with _AFXDLL defined.

2. An extension DLL can also be used by a regular DLL that is dynamically linked to MFC.

3. Extension DLLs should be compiled with _AFXEXT defined. This forces _AFXDLLto be also defined and ensures that the proper declarations is pulled in from the MFC header files. It also ensures that AFX_EXT_CLASS is defined as __declspec(dllexport)while building the DLL, which is necessary if you are using this macro to declare the classes in your extension DLL.

4. Extension DLLs should not instantiate a class derived from CWinApp, but should rely on the client application (or DLL) to provide this object.

5. Extension DLLs should, however, provide a DllMain function and do any necessary initialization there.

6. Extension DLLs are built using the dynamic-link library version of MFC (also known as the shared version of MFC).Only MFC executables (either applications or regular DLLs) that are built with the shared version of MFC can use an extension DLL. Both the client application and the extension DLL must use the same version of MFCx0.dll. With an extension DLL, you can derive new custom classes from MFC and then offer this extended version of MFC to applications that call your DLL.

VC++ Extension Dlls -