使用Visual Studio C ++ 2010中的命令行创建DLL和LIB文件(Create a DLL and LIB file using command line from Visual S

编程入门 行业动态 更新时间:2024-10-25 06:20:57
使用Visual Studio C ++ 2010中的命令行创建DLL和LIB文件(Create a DLL and LIB file using command line from Visual Studio C++ 2010)

我试图使用LIbrarian> Command Line中的以下选项

/OUT:"mylib.lib" "mylib.dll" /DEF:"mydef.def"

但是,它只生成静态库。 当我的DLL文件名在/OUT指令之前时,它只生成DLL,但不生成LIB。

我只是想为我的库创建DLL和LIB文件,而不必使用__declspec(dllimport)或__declspec(dllexport)

有人能帮助我吗?

I have tried to use the following option from LIbrarian > Command Line

/OUT:"mylib.lib" "mylib.dll" /DEF:"mydef.def"

However, it only generated the static library. When my DLL filename precedes the /OUT directive, it only produces DLL, but not LIB.

I simply want to create DLL and LIB files for my library without having to use __declspec(dllimport) or __declspec(dllexport)

Could someone help me

最满意答案

尝试这个:

/OUT:"mylib.dll" /IMPLIB:"mylib.lib" /DEF:"mydef.def" /DLL

从命令行,您需要/DLL但/IMPLIB不是必需的,因为默认名称将取决于您的DLL名称。

从IDE编译时,编译具有/LD参数,该参数确保将/DLL传递给链接器。 因此,如果您自己构建命令行,则需要明确说明。

Try this:

/OUT:"mylib.dll" /IMPLIB:"mylib.lib" /DEF:"mydef.def" /DLL

From the command line, you need /DLL but the /IMPLIB is not strictly necessary because the default name will depend on your DLL name.

When compiled from the IDE, the compile has a /LD parameter, which ensures that /DLL is passed on to the linker. So if you're building the command line yourself you need to make it explicit.

更多推荐

本文发布于:2023-07-15 21:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1119345.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令行   文件   DLL   Visual   Studio

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!