What good is an Inker?

Asked

Viewed 3,111 times

7

Some languages use a Linker or likeditor as it is also called. What is its function and its relation to the compiler?

Why some languages do not have a Linker?

1 answer

8


The Linker is a utility that is usually complementary to compiler. It takes binary code generated by the compiler and merges everything, hence the name, into an executable. The executable can be something for direct call or dynamic call (DLL).

Eventually it can generate a library with several binary codes and it can be used later to generate an executable. In this case the library needs to be specified to link together.

Often the beginner programmer doesn’t understand why he used a #include but gives error that did not find a symbol (function, global variable, types, etc.). It is not a problem in the code but in the linkediting, failed to specify where to pick up this symbol, either in the library or in another separate generated binary in another compilation process.

It is common for the compiler to generate a compilation unit, in some contexts called object code. This unit may contain multiple sources. The Linker joins these units, so everything inside it will be placed in the executable, even if it will not use in the application. In languages that have classes the compilation unit may include the whole class, or a group of classes.

It understands how to generate the executable format for each platform, and can do some optimizations that are only possible when all the code is together (LTO). In general it makes a relocation of internal addresses when it gathers everything.

Languages that have a bytecode or are interpreted as not having Linker traditional since they do not generate binary code. Some of these languages have a Jitter that will generate binary code all together.

Has utility that gathers the compiler and the linkeditor, then it may seem that there is no binary binder, but it already does right after compiling.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.