Extension dll is often used when developing PC Desktop programs because it can export classes, which facilitates System Development and Integration. However, it is different from PC in PPC.
1. Create Extension DLL
File-> New-> Project-> MFC Smart Device Dll-> MFC extension Dll.
After the project is created, add a class, such
Class CTheDll: public CWnd
{
DECLARE_DYNAMIC (CTheDll)
Public:
CTheDll ();
Virtual ~ CTheDll ();
Protected:
DECLARE_MESSAGE_MAP ()
Public:
Int AddInteger (int a, int B); // adds a function and implements
};
Add AFX_EXT_CLASS before the class after implementing the new function. Changed:
Class AFX_EXT_CLASS CTheDll: public CWnd
{
DECLARE_DYNAMIC (CTheDll)
Public:
CTheDll ();
Virtual ~ CTheDll ();
Protected:
DECLARE_MESSAGE_MAP ()
Public:
Int AddInteger (int a, int B );
};
Compile after completion. Copy the compiled *. lib and *. H files to the test program folder.
Call AddInteger () in the test program ();
Now you can debug the program, and the test program compilation will not go wrong, but the runtime times "Unable to start pragma ....".
Upload the dllth to the file where the program .exe is located.
2. Differences:
On a PC, generally, the development program dynamically loads dll by default, while PPC is statically loaded by default, so the above problems will occur. If you don't want this problem, you must select use MFC in a shared Dll instead of use MFC in a static library during development.