If you work with GCC, you can use gcc -v to see what is executed on your behalf. That is, options that work on Linux won't necessarily work on Solaris, AIX, macOS, Windows, and similarly for any other platform. It is possible to invoke the linker directly, but this is seldom advisable, and is typically very platform-specific. Now you have a file called myprog that you can run and which will hopefully do something cool and/or useful. This line tells the compiler to link together three object files ( foo.o, bar.o, and baz.o) into a binary executable file named myprog. Thus, the normal way of using the linker is as follows: % gcc foo.o bar.o baz.o -o myprog Also like the pre-processor, the linker is invoked automatically for you when you use the compiler. Like the pre-processor, the linker is a separate program, often called ld (but Linux uses collect2, for example). so, and you normally don't need to know about them, as the linker knows where most of them are located and will link them in automatically as needed.
#SYMBOLICLINKER VS CODE#
This includes both the object files that the compiler created from your source code files as well as object files that have been pre-compiled for you and collected into library files. Once it's got the load addresses, it can replace all the symbolic addresses in the object code with "real", numerical addresses in the target's address space. It will then assign load addresses for the object files, that is, it specifies where the code and data will end up in the address space of the finished program. The result of the link process is normally an executable program.ĭuring the link process, the linker will pick up all the object modules specified on the command line, add some system-specific startup code in front and try to resolve all external references in the object module with external definitions in other object files (object files can be specified directly on the command line or may implicitly be added through libraries). The process of linking mainly involves resolving symbolic addresses to numerical addresses. The job of the linker is to link together a bunch of object files (. Literals for numbers, characters and strings.Iteration Statements/Loops: for, while, do-while.Common C programming idioms and developer practices.- character classification & conversion.