简体   繁体   English

.dll和.lib在编程语言方面是否有所不同?

[英]Does .dll and .lib differ by programming language?

例如,如果.dll或.lib是用C编写的,是否可以被其他语言(如PHP / Python)使用?

A DLL is binary. DLL是二进制的。 As long as your language can consume a binary library (with the OS the binary was compiled for), you should be okay (see exceptions below). 只要您的语言可以使用二进制库(使用二进制编译的操作系统),您就可以了(请参见下面的异常)。 LIB files are for the compiler so you'll only be able to use those by C/C++ languages at compile time. LIB文件是用于编译器的,因此您只能在编译时使用C / C ++语言的文件。

The exception to this is .NET and COM. .NET和COM是例外。 .NET generates special assembly DLLs to be used by other .NET languages (C#, VB.NET, C++/CLI, IronPython, etc). .NET生成特殊的程序集DLL,以供其他.NET语言(C#,VB.NET,C ++ / CLI,IronPython等)使用。 COM generates special DLLs as well where components (specialized classes) are exposed through the DLL. COM也会生成特殊的DLL,并且通过DLL公开组件(专用类)。 Natively, C++ and VB6 support COM. 本地,C ++和VB6支持COM。 .NET languages can access COM DLLs through an interop. .NET语言可以通过互操作访问COM DLL。 Many other languages also support COM bindings by various means. 许多其他语言也通过各种方式支持COM绑定。

Go here for a discussion on this topic and more details about the differences. 转到此处 ,就该主题进行讨论,并详细了解不同之处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM