Compiler Linker and Loader

Consider three source code files main.c, f1.c, and f2.c, containing some C source codes. The function main is defined in the file main.c, function f1 is defined in the file f1.c and function f2 is defined in the file f2.c.
The function main calls the function f1, and function f1 in turn calls the function f2. Your object is to create an executable file named say project.

Qu.1. What are the steps to be followed, when finally you execute “project” starting from source code preparation?

Qu.2. Is it possible to compile the file main.c, without having files f1.c, f2.c? Mention an option of a compiler that you know which is used to accomplish this.

Qu.3. Will there be any difference in the final executable, if it is produced for a 32 bit system / 64 bit system? Name a command by which you can find out the type of the executable file.

Qu.4. Suppose now the file f1.c contains a function f1, which is completely defined in that file and file f2.c, which contains a function f2, which is also completely defined in that file. The file main.c can either call f1 or f2. How can you ensure that the executable file will only contain the code for that function and no redundant code?

Qu.5. Please see, what type of assembly code is created, corresponding to the function call statements in your system

Replies

You are reading an archived discussion.

Related Posts

I am from the stream Electrical and I got a Rank of 10017 in GATE 2010 and a score of 293, and I have reservation under SC category. I am...
Hi, I'm using fedora 12. I've installed ns2.31 but there is a problem with nam which does not run and the following error message appears [root@localhost ex]# ns tcpapp.tcl running...
prove the formula: (111*)* = (11 + 111)* thank you for helping
Hello everyone, I'm in my final year of B.Tech. CS now. I have been placed in TCS as of now and I also have a GATE score of 464 this...
why we generally prefer nand logic over nor,though both are universal gates??