(1)新建项目,选择 Win32 Console Application(win32控制台应用程序)
命名getdll
(2)点next(下一步),然后Application type(应用程序类型)选择DLL
(3)在getdll.cpp中编写代码
代码示例:
extern "C"
{
_declspec(dllexport) int sum(int x)
{
int y = 0;
for (int a = 1; a <= x; a++)y += a;
return y;
}
}
(4)编译
进入这个Debug目录
这个dll就是我们需要的文件