添加非“类型库” dll 作为 VS C++ 的参考2008年
我刚刚收到同事的请求,询问为什么无法在带有 MS .Net Framework 版本 3.5 SP1 的 Visual Studio 2008 版本 9.0.21022.8 RTM 中添加特定 dll 作为引用。
使用的语言是 Visual C++ 2008,我从来没有用这种语言做过任何事情,虽然我之前用过一些 C#...
请检查以下两条错误消息,第一个来自我的笔记本电脑,第二个来自我同事的笔记本电脑:
根据我的 Google 研究,我担心目标 dll 是:
不是类型库。通过运行 tlbimp 实用程序进行确认:
tlbimp C:\test\tm1api.dll ...... 错误 TI0000:输入文件“C:\test\tm1api.dll”不是有效的类型库
这是什么意思,有什么可以将其转换为类型库吗?
不是 .NET 程序集或注册的 ActiveX 控件。恐怕该 dll 不是在 VS 中编写的。但我如何验证这一点?
基本上我很困惑,因为两个 VS 2008 显示不同的错误消息,这个问题是否仅针对 VS 2008?或者VS中有针对此类事情的通用解决方案吗?
非常感谢提前的帮助。
I just received a request from colleague to work out why a specific dll cannot be added as a reference in Visual Studio 2008 Version 9.0.21022.8 RTM with MS .Net Framework Version 3.5 SP1.
The language used is Visual C++ 2008, I have never done anything in this language, although I've done a bit in C# before...
Please check the following two error messages, first one came from my laptop, the second from my colleague's:
From my Google research I am afraid the target dll is:
NOT a type library. Confirmed by running the tlbimp utility:
tlbimp C:\test\tm1api.dll ...... error TI0000 : The input file 'C:\test\tm1api.dll' is not a valid type library
What does this mean, anything to convert it to a type library?
NOT a .NET assembly or a registered ActiveX Control. The dll was not programmed in VS I am afraid. But how could I verify this?
Basically I am confused, because two VS 2008 show different error messages, is this issue specific to VS 2008 only? Or is there a general solution in VS for this sort of thing?
Many thanks to the help in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可能只有一个普通的旧dll。使用 dllimport 访问其方法。请注意,与 C++ dll 交互时通常会出现各种数据编组问题,例如您可能需要使用短整型而不是 int,以及 IntPtr 而不是数组......类似的东西。
you've probably got just a regular old dll. use the dllimport to access its methods. Be aware that there are usually all kinds of data marshalling issues when interacting with a C++ dll, like instead of int you might need to use short, and IntPtr instead of arrays...stuff like that.