如何在项目中使用dll [英] how to use dlls in the project

查看:108
本文介绍了如何在项目中使用dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在项目中使用现成的dll.?????????

how we can use readily available dlls in our project.????????

推荐答案

您是说要添加参考在Visual C#中?"
Do you mean How to: Add or Remove References in Visual Studio[^], section "To add a reference in Visual C#"?


对于.NET,DLL的外观有所不同,具体取决于哪种DLL.

1)DLL可以是某些.NET程序集的主要可执行模块(Visual Studio每个程序集仅支持一个,但是原始C#编译器允许创建很多-请勿将这些其他模块与引用的程序集混合使用-它们是完全不同的东西).在这种情况下,另一个程序集可以引用它.在这种情况下,DLL,EXE或其他内容只是文件名的一部分;对于.NET而言,它几乎没有什么区别.其他程序集甚至可以将用作应用程序可执行模块的EXE文件作为常规类库DLL进行引用;当插件使用EXE主机应用程序中声明的类型时,有时在插件体系结构中使用.
请使用Mika提供的参考.

2)DLL可以是要在汇编中使用的其他可执行模块. Visual Studio不支持它们,但是原始C#编译器可以选择链接.请参阅编译器命令行上的文档.此功能很少使用.

3)DLL是其他东西,通常是本机(非托管)共享库.要在.NET中使用它们,您需要学习 P/调用.请参阅
http://msdn.microsoft.com/en-us/library /aa719104%28v=vs.71%29.aspx [ ^ ].

—SA
A DLLs look differently for .NET depending on what kind of DLL is that.

1) A DLL can be a main executable module of some .NET Assembly (Visual Studio supports just one per assembly, but raw C# compiler allows to create many — don''t mix those additional modules with referenced assemblies — they are completely different things). In this case, another assembly can reference it. In this case, DLL, EXE or something else is just a part of file name; for .NET it makes little difference; even EXE files used as application executable modules can be referenced by other assemblies as normal class library DLLs; this is sometime used in plug-in architectures, when plug-ins use type declared in EXE host application.
Use the reference provided by Mika.

2) A DLL can be additional executable module to be used in assembly. Visual Studio does not support them, but raw C# compiler has an option to link then. See the documentation on the compiler command line. This feature used rarely.

3) A DLL is something else, usually a native (unmanaged) shared library. To use them in .NET you need to learn P/Invoke. See http://msdn.microsoft.com/en-us/library/aa719104%28v=vs.71%29.aspx[^].

—SA


这篇关于如何在项目中使用dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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