Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does .dll and .lib differ by programming language?

Say,if the .dll or .lib is written in C,can it be used by other languages like PHP/Python?

like image 904
user198729 Avatar asked Sep 11 '26 01:09

user198729


1 Answers

A DLL is binary. 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.

The exception to this is .NET and COM. .NET generates special assembly DLLs to be used by other .NET languages (C#, VB.NET, C++/CLI, IronPython, etc). COM generates special DLLs as well where components (specialized classes) are exposed through the DLL. Natively, C++ and VB6 support COM. .NET languages can access COM DLLs through an interop. Many other languages also support COM bindings by various means.

Go here for a discussion on this topic and more details about the differences.

like image 76
Jordan Parmer Avatar answered Sep 14 '26 01:09

Jordan Parmer