Answer the question
In order to leave comments, you need to log in
How do libraries work and how does a compiler work?
What is the difference between dynamic and static libraries? What is an executable file? What is a translator, linker? Until now, I have not asked such questions until I needed to compile the library from source code and link it to my project. Such a trifling task gave birth to even more questions in me when searching for its solution, since I simply could not answer the question of what a compiler is (for me it was like a black box).
I really need articles or books on similar topics.
Answer the question
In order to leave comments, you need to log in
In short:
Dynamic library - all dependencies (libraries - dll\so\dylib) are not included in the library\executable file. Those. for work it will be necessary that they be in the system or lie nearby. The advantage is that libraries can be updated (as a rule, this is often not possible), the compiled library \ executable file is small.
Static library - all dependencies (libraries - lib\a) are "pasted" into your library\executable file during compilation. The advantage is that all dependencies (libraries) are embedded inside and, as it were, the end user needs less gestures to make everything work. The size of the library\executable becomes huge.
An executable file is already a binary (binary) program that your CPU can execute.
A translator is, roughly speaking, a translator. Translates 1 language into another. For example, it translates human-readable "C++" source code into "C" or assembler or machine code.
Linker (aka linker) - again, very rudely, this is a utility that looks at all source code and links to libraries, after which it compiles a so-called symbol table in which it indicates where it is located and what the function from another library is called. It also denotes exported functions that other libraries can see.
Compiler - in short, it is a set of utilities that are run in a certain order in order to get machine code from the source code that can be executed on the CPU. There are many stages in it, incl. it includes linking and broadcasting.
If you want to understand this normally and understand everything absolutely correctly and not as I described, then see the recommendations that have already been given above for the "book of the dragon". I described all this to you very rudely just to imagine what it is.
PS made a copy-paste correction =) Daniil Demidko
System Programming for Windows 3rd edition. (Johnson M. Hart) - Dynamic Link Libraries Chapter
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question