| 一、在新建菜单中选择新建工程Win32 Dynamic Link Library,选择dll1,新建dll1.cpp,加入代码: _declspec(dllexport) int add(int a,int b)
 { return a+b; } _declspec(dllexport) int subtract(int a,int b) { return a-b; } 二、编译,可发现dll1\Debug下生成了dll1.dll和dll1.lib文件。 三、新建基本对话框文件dlltest 将生成了dll1.dll和dll1.lib文件考到dlltest目录下   四、在dlltest加入二按钮 1、  ID: IDC_BUTTON1 标题:add 2、  ID: IDC_BUTTON2 标题:subtract 五、加入代码 在Project->Setting->Link->Object/Library中加入Dll1.lib,此种方式为隐式调用!OK! 。。。。。。。。。。。。。。。。。 _declspec(dllimport) int add(int a,int b); _declspec(dllimport) int subtract(int a,int b); void CDlltestDlg::OnButton1()  {        // TODO: Add your control notification handler code here        CString str;        str.Format("5+3=%d",add(5,3));        MessageBox(str); }   void CDlltestDlg::OnButton2()  {        // TODO: Add your control notification handler code here        CString str;        str.Format("5-3=%d",subtract(5,3));        MessageBox(str); }   |