1.
C and C + + code differences in driver code
A, function calling convention
B, C, and C + + compilation Methods
C. Compile driver in C + + mode
D, C code upgrade to C + +
E, optimize the code for lesson 21
This lesson is mainly to do two work: "D, C code upgrade to C + +", "E, optimize the code of 21 Lessons"
"180" Copy the code from lesson 21st.
2.
*.c
The compiler will compile with the C compiler when the file suffix name is *.c
*.cpp
When the file suffix name is *.cpp, the compiler will compile in C + + compiler mode
Difference:
Solutions
add extern "C" before a function that requires C-mode compilation
The header files that need to be compiled in C are modified as follows
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
#include <NTDDK.h>//This contains header files that need to be compiled in C
#ifdef __cplusplus
}
#endif
1>errors in directory g:\ driver tutorial \024_ C and C + + code differences in driver code \MINI_DDK
1>mini_ddk.obj:error lnk2001:unresolved external symbol "struct _servicedescriptortable * keservicedescriptortable ([email Protected]@[email protected]@a)
1>bufferoverflowk.lib (gs_support.obj): Error lnk2019:unresolved external symbol [email protected] referenced in Func tion [email protected]
1>sys\i386\ddk_helloworld.sys:error Lnk1120:2 unresolved externals
[Email protected]@[email protected]@[email protected]@@z
[Email protected]//Request format
[Email protected]@[email protected]@[email protected]@@z?
Instance modification 21 Lesson code upgrade to C + + compilation mode
A, add extern "C" for the entry function
B. Modify the source file
C, modify the 21 lesson bug
extern "C" __declspec (naked) __stdcall Test (int a, int b)
Yjx_driver_024_ C and C + + code differences in driver code