Using the MFC Conventional Dynamic Link Library 1, copy the generated dynamic link library file (REGUDLL.DLL) and library file (REGUDLL.LIB) to the DLLTEST to be called, add (regudll.lib) file to Call the project DLLTEST. 2, add the following code in the calling project, declare the dynamic link library function: #define dllimport _declspec (dllimport) Extern "C" Dllimport Float Myfunction (Float F1, Float F2); 3, in Dlltestdlg The following code is added to the onbutton1 () function in .CPP, directly call dynamic link library functions: float x1, x2, sum; x1 = 12; x2 = 102; SUM = myfunction (x1, x2); cstract str.Format ("THE SUM OF% F and% F I% F", X1, X2, SUM); MessageBox (STR);
Note: Source code download