该记录仅作为学习参考,记录学习过程中遇到的问题,以及解决办法。
MinGW的安装和编译出DLL:
- 下载:https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/
- 安装:https://www.cnblogs.com/lidabo/p/8990348.html
- 编译生成动态链接库DLL:
step1 建立DLL项目,结构如下:
test/
----mydll.h
----mydll.c
头文件mydll.h
#ifndef _MY_DLL_H
#define _MY_DLL_H_
#ifdef __cplusplus
extern "C" {
#endif
extern __declspec (dllexport) int add_range (int, int);
extern __declspec (dllexport) double average (int*, int);
#ifdef __cplusplus
}
#endif
#endif // ~_MY_DLL_H_
C文件:mydll.c
#include "mydll.h"
// __decls