打开 文件——》新建——》MFC AppWizard[dll]
剩下的一路默认
在.cpp里面添加
extern "C" _declspec(dllexport)
int PASCAL out_num(int x)
{
int y;
char msg[30];
sprintf(msg,"计算结果:%!",y);
::MessageBox(NULL,msg,"信息",MB_OK);
return 0;
}
在文件里面查找.def 添加
; pbdll.def : Declares the module parameters for the DLL.
LIBRARY "pbdll"
DESCRIPTION 'pbdll Windows Dynamic Link Library'
EXPORTS
; Explicit exports can go here
out_num @1
这时点击菜单 组建 ——》 部分组建 点击确定就好了
去项目文件夹下面 找 Release 找dll文件 就可以了