1、新建——项目——Windows桌面向导
2、应用程序类型选择动态链接库(.dill),并勾选空项目
步骤3:添加.h头文件和.c函数实现文件, 其中头文件中每个函数的声明墙边都要加上一句__declspec(dllexport)
其中头文件内容如下
#pragma once
//兼容C++编译器
#ifdef __cplusplus
extern "C"
{
#endif
//函数1
__declspec(dllexport)
int fun1(void );
//函数2
__declspec(dllexport)
int fun2(void);
#ifdef __cplusplus
}
#endif
#endif
其中.c文件内容如下
#include <stdio.h>
#include "fun.h"