Steps to create a dynamic connection library:
First, create NON-MFC DLL dynamic link library
1, open file-> new-> project option, select Win32 dynamic-link library->sample Project
-> Project Name: Dlldemo
2, a new one. h file DllDemo.h
#ifdef Dlldemo_exports
#define DLLAPI __declspec (dllexport)
#else
#define DLLAPI __declspec (dllimport)
extern "C"//compiled as is
{
Dllapi int __stdcall Max (int a,int b); __stdcall enables the ability to invoke APIs within non-C + + languages
}
#endif
3, import DllDemo.h file in DllDemo.cpp file, and implement Max (Int,int) function
#include "DllDemo.h"
Dllapi int __stdcall Max (int a,int b)
{
if (a==b)
return NULL;
else if (a>b)
return A;
Else
return b;
}
4, compile the program to generate dynamic connection library
Create a dynamic connection library DllDemo.dll with a. def file.
1, delete the Dlldemo project in the DllDemo.h file.
2, in the DllDemo.cpp file header, delete #include DllDemo.h statement.
3. Add a text file to the project, name it dlldemo.def and write the following statement:
LIBRARY Mydll
Exports
max@1
4, compile the program to generate dynamic Connection library.