Development tools: Visual Studio Pro
There are altogether two projects, one is a: project name MYSDK, Static library, multibyte, use MFC in static Library, runtime uses "multithreaded Debug DLL (/MDd)", and the other is B: Executable program, multibyte, use MFC in static library, add _afxdll to preprocessor definition, The runtime uses the multithreaded debug DLL (/MDD).
In project A's interface file:
#ifdef mysdkinterface_static #define Mysdkinterface_api#else#ifdef mysdkinterface_exports#define MYSDKINTERFACE_API __ Declspec (dllexport)#else#define mysdkinterface_api __declspec (dllimport)#endif# endif// mysdkinterface_static
The preprocessor definition for project a increases mysdkinterface_static, the preprocessor definition for item B increases mysdkinterface_static, additional dependencies increase MySdk.lib, and the input library directory increases the directory where Lib resides.
The memory allocated by MYSDK needs to be released on its own and is not recommended for EXE.
Static library using MFC in static library