VC to create DLL dynamic link library method

  • 2020-04-02 03:03:00
  • OfStack

This article illustrates the method of VC to create DLL dynamic link library. Share with you for your reference. The specific implementation method is as follows:

The header file declares t.h.


#ifdef DLL_API 
#else
#define DLL_API extern "C" _declspec(dllimport)
#endif
DLL_API int a(int cnt);
DLL_API int b(int cnt);

.h file introduction


#define DLL_API extern "C" _declspec(dllexport)
#include "t.h"

Write the body of the function in the CPP file


#define DLL_API extern "C" _declspec(dllexport)
#include "t.h"
int a(int cnt)
{
return cnt+1;
}
int b(int cnt)
{
return cnt+10;
}

Hope that this article described the VC programming for you to help.


Related articles: