返回首页
EN
H7 / SECURITY RESEARCH NOTES

使用def文件来编写dll

  • 两个文件:一个c文件,一个.def文件
  • main.c内容如下:
#include <windows.h>
#include <stdio.h>

int sub(int a, int b) {
	return a - b;
}

int add(int a, int b) {
	return a + b;
}
  • main.def内容如下:
LIBRARY dll_with_def
EXPORTS
	add @1
	sub @2

参考链接

1.https://docs.microsoft.com/en-us/cpp/build/exporting-from-a-dll-using-def-files?view=msvc-170