如何禁用导入库的生成? [英] How do I disable the generation of an import library?

查看:33
本文介绍了如何禁用导入库的生成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Visual Studio 中创建一个 COM DLL.链接器为 DLL 生成一个导入库.我不需要导入库.

I'm creating a COM DLL in Visual Studio. The linker generates an import library for the DLL. I don't need the import library.

有没有办法告诉链接器不要生成它?

Is there any way to tell the linker not to generate it?

推荐答案

九年后,这可能对 OP 没有用,但它可能证明对其他寻求解决方案的人有用.

Nine years later, this may not be useful to the OP, but it may prove useful to others coming by looking for a solution.

LINK.EXE 支持防止创建导入库的 /NOIMPLIB 选项,即使 DLL 中存在 __declspec(dllexport) 例程EXE 被链接.

LINK.EXE supports the /NOIMPLIB option that prevents creation of an import library, even in the presence of a __declspec(dllexport) routine in the DLL or EXE being linked.

转到项目属性,打开 Linker 部分.最后一个选项是Command Line.选择它,底部有一个地方可以向链接器添加其他选项.在编辑字段中输入 /NOIMPLIB,保存并应用,它会阻止创建 .lib 文件.

Go to Project Properties, open up the Linker section. The very last option is Command Line. Select that, and there's a place at the bottom to add additional options to the linker. Enter /NOIMPLIB in the edit field, save and apply, and it'll prevent the creation of the .lib file.

-- 编辑 --

不幸的是,虽然它确实阻止了 .lib 文件的创建,但凭经验我发现仍然创建了 .exp 文件.我会向 MS 提交错误报告,但根据他们开发工具团队过去的经验,尝试修复此类问题类似于尝试将巨石滚上山坡.

Unfortunately, while it does prevent creation of the .lib file, empirically I've found that the .exp file is still created. I'd file a bug report with MS, but based on past experience with their developer tools team, trying to get something like this fixed will be akin to trying to roll a boulder up hill.

这篇关于如何禁用导入库的生成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆