使用Clang编译DLL时指定DEF文件 [英] Specifying the DEF file when compiling a DLL with Clang
本文介绍了使用Clang编译DLL时指定DEF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Windows中使用clang编译DLL
I am trying to compile a DLL using clang in windows
clang -shared structs.c -o structs.dll
但符号未导出。.
如果我在structs.h中的声明中添加__declspec(dllexport),它们的符号将导出到DLL。
If I add __declspec(dllexport) to my declarations in structs.h, They symbols are exported to DLL.
但是,我想使用我创建的一个DEF文件(structs.def),但是我找不到将DEF文件传递给clang的方法。
But instead, I would like to do this using a DEF file (structs.def) I created, But I can't find how I pass the DEF file to clang.
任何帮助都很感激:/
Any help is appeciated :/
推荐答案
最后弄清楚了-
- 我们可以使用clang中的-Wl标志将一些逗号分隔的参数传递给链接器。
- DEF文件可以使用/ DEF参数指定
示例
clang -shared structs.c -o structs.dll -Wl"/DEF:structs.def"
这篇关于使用Clang编译DLL时指定DEF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文