(* 1 *): Establish a DLL project. In the second step 1. It is default. // This DLL project is only used to output two functions. Don't use it. Add files DLL.cpp: The file content is as follows: #include "stdio.h" void __declspec (dllexport) Exportone (Void) {printf ("I am exportone! / N");} void __declspec (dllexport) ExportTwo (void) { Printf ("I am EXPORTTWO! / N");} Compilation operation generates Dll.Obj DLL.DLL. [[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] ],],]],]]]]]]]]]]]]]]]]]]]) Can also create: // file DLL.CPP # include "stdio.h" // void __declspec (dllexport) Exportone (void) void exportone Void) {PrintF ("I am exportone! / n");} // void __declspec (dllexport) ExportTwo (Void) Void ExportTwo (Void) {Printf ("I am ExportTwo! / N");} // File DLL .def; dll.def: Declares the module parameters for the dll.
Library "DLL" Description 'DLL Windows Dynamic Link Library "
Exports; Explicit Exports Can Go Hered Exportone @ 1 ExportTWO @ 2 []]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] ]]]]]]]]]]]]]]]
(* 2 *): Establish a lib engineering. // This lib project is only used to test two functions that introduce the output of the DLL output. Add file lib.cpp file content as follows:
#include "stdio.h" void exportone (void); void optWO (void); void main () {exportone (); exporttwo ();} Compilation runs generating lib.obj lib.exe. (* 3 *) lib. Obj analysis (* 4 *) anti-compile lib.obj. Note that the file offset of the code section is 00000392
: 00000000 55 Push EBP ... 0000000018 E800000000 Call 0000001D // This is exportone () call: 0000000022 / / This is exporttwo () call ...: 00000032 C3 RET
(* 5 *) LIB.exe analysis:
: 00401000 55 Push EBP ...: 00401017 AB StosD
* Reference to: dll.Exportone, Ord: 0001H |: 00401018 E81D000000 Call 0040103A
* Reference to: dll.exporttwo, Ord: 0002H |: 0040101D E812000000 Call 00401034 ...: 00401032 C3 RET
: 00401033 CC INT 03 * Reference by a call at address: |: 0040101D |
* Reference to: dll.exporttwo, Ord: 0002H |: 004010276334000 JMP DWORD PTR [0040C0C8]
* REFERENECED by a call at address: |: 00401018 |
* Reference to: dll.exportone, Ord: 0001h |: 0040103A FF25C4C04000 JMP DWORD PTR [0040C0C4]
(* 6 *) The difference between the introduction function and the non-introduced function. As we can see, in fact, whether it is not an introduction function, the function called code generated by the compiler is in the form of Call XXXXXXXX. // from dll.libarchive Member Name at 8: / 3e951f55 Time / Date Thu Apr 10 15:37:57 2003 ... Correct Header End 7 Public Symbols