尝试使用 gcc 编译一个用 C 编写的简单 DLL。
尝试了许多教程,但即使我将文件剥离到最基本的内容,也无法编译它。
test_dll.c
#include <stdio.h>
__declspec(dllexport) int __stdcall hello() {
printf ("Hello World!\n");
}
尝试使用命令编译它
gcc -c test_dll.c
失败,得到这个输出
test_dll.c: In function '__declspec':
test_dll.c:3:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'hello'
__declspec(dllexport) int __stdcall hello() {
^
test_dll.c:5:1: error: expected '{' at end of input
}
^
gcc 版本
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)