① When DLL is used as a C ++ source file, the exported function must be added to the header file:
Extern "C" {// export function declaration ......};
② The above method cannot be recognized by external functions (with xxx @ number). Use the following method:
Set a function to be exported:
Lresult callback keyboardproc (INT ncode, wparam, // stores the VK value lparam // stores the number of repetitions, scan codes, extensions ....);
Then:
/// Force export function: the alias of _ keyboardproc @ 12 is: keyboardproc // The rule is prefixed with "_ function name @ parameter number of nodes ], you can use the // dependency Walker tool to view the modified name // # pragma comment (linker, "/export: keyboardproc = _ keyboardproc @ 12 ") //// set aside a standard export function interface extern "C" for the external C language {// export function dlltest_api lresult callback keyboardproc (INT ncode, wparam, // stores the VK value lparam // stores the number of repetitions, scan codes, and extensions ....);};
The preceding dlltest_api is defined:
# Define
Dlltest_api _ Declspec(Dllexport)
After the above processing, the export function is named keyboardproc;
As described in the above comment, the export function in dll should be frequently viewed using the VC tool dependencywalker!