Home>Article>Backend Development> Can functions in C language be compiled separately?

Can functions in C language be compiled separately?

藏色散人
藏色散人 Original
2020-04-15 10:43:01 9943browse

Can functions in C language be compiled separately?

#Can functions in c language be compiled separately?

OK.

Recommended tutorial: "c Language Tutorial"

For example, library function is to put the function in the library, compile some commonly used functions and put them in a file , for different people to call. The library functions of C language are not part of the C language itself. It is a set of programs compiled by the compiler according to the needs of general users and provided for users to use.

Static compilation in windows places both the export declaration and implementation in lib. The dynamic LIB file is equivalent to an h file in C language. It is a declaration of the function export part, without embedding the implementation process into the program itself. After compilation, it only stores the function address in the host program. When running to call the function, it calls the DLL and Load the function to implement the specific operation of the function.

Therefore, functions in C language can be compiled and exported separately.

Can functions in C language be compiled separately?

Extended information:

Related methods and files for separate compilation:

1. The lib file must be connected during compilation in the application, and the dll file is called during runtime. If there is a dll file, the corresponding lib file is generally some index information, and the specific implementation is in the dll file. If there is only a lib file, then this lib file is statically compiled, and the index and implementation are in it.

2. There are advantages to statically compiled lib files: there is no need to install dynamic libraries when installing them to users. But there are also disadvantages, which is that the application is relatively large and the flexibility of the dynamic library is lost. When the version is upgraded, a new application must be released at the same time.

The above is the detailed content of Can functions in C language be compiled separately?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn