Comparison between libraries in Linux and Windows

Source: Internet
Author: User

Library Definition

Library files are a collection of pre-compiled functions, which are all written in accordance with reusable principles. They are usually composed of a group of interrelated functions used to complete a common task. Essentially, the Library is a binary form of executable code that can be loaded into the memory for execution by the operating system.

Whether inWindowsPlatform orLinuxThere are a large number of libraries in the platform, but because Windows and Linux are essentially different, the binary of the two libraries is incompatible.

Database category

There are two types of libraries in Windows: static library (. lib) and dynamic library (. dll ).

There are two types of libraries in Linux: static library (. a) and shared library (. so ).

The static library name in Linux is generally libxxxx. a, where xxxx is the name of this lib

In Linux, the dynamic library name is generally libxxxx. so. major. minor, xxxx is the lib name, major is the main version, and minor is the minor version.

Differences between libraries in Windows and Linux

Linux shared library (. so) is like Windows dynamic link library (. dll), which contains many common functions. To facilitate program development and reduce program redundancy, you do not need to include copies of each common function in the program. You only need to call common functions in the shared library when necessary. This method is called Dynamically Linked ). Sometimes we do not want a program to call functions of the shared library, but directly link the library function code to the program code. That is to say, the program itself has a copy of the functions in the shared library. This method is called static link Statically Linked ).

Therefore, the difference between a static library and a shared library (dynamic library) is that the Code is loaded at different times.

The code of the static library has been loaded into the executable program during compilation, so the size is large.

The code of the shared library is loaded into the memory only when the executable program runs. It is only referenced in the compilation process, so the code size is small.

Differences between dynamic link library (. dll) in Windows and shared library (. so) in Linux

The. dllfile and the. exe file are the same as the execution files in PE format. For implicit reference of external symbols, the position of the external symbols must be written on the PE Header. The PE Loader finds the dependent symbol table from the PE Header and loads other dependent. dll files.

This is not the case in Linux !. Most of the so files are in the elf execution file format. When they need external symbols, they do not indicate the location of these symbols. That is to say, the. so file does not know which. so symbols it depends on. These symbols are provided by the running process that calls dlopen.

We also need to carry a. lib file when creating a. dll file in Windows. In Linux, only the corresponding header file is required. For writing a new. so file, you can leave it there until the final execution file combines all the required symbols. In windows, one. dll can be implicitly dependent on another. dll. in Linux, implicit dependency between. so and. so is generally not required.

Through the introduction above, we have a certain understanding of the concept of the library, and understand the differences between Linux and Windows libraries, I hope you will learn more about Linux in your work.

  1. Differences between linux and windows
  2. Because users are not used to Linux Windows netbooks
  3. Details on coexistence of three Linux and windows systems
  4. Secrets of Linux File System Knowledge
  5. Ext4 Performance Improvement released in Linux Kernel 2.6.37
  6. Microsoft announces support for ARM processors for the next generation of Windows
  7. Five things you need to know about Windows 7 Security
  8. Take you to understand SQL Sever database files
  9. 3.4 Flex library file SWC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.