-
object files and linker
when I link files together, does the linker strip out unused code from the object file?
For example, I create an object file that contains a lot of functions. I write a main.c that only calls one of the functions in the object code. Does the whole object file get included in my final exe?
-
1st source code:
Code:
file 1:
#include <stdio.h>
int main()
{
message1();
return 0;
}
file 2:
int message1()
{
printf("message");
return 0;
}
2nd source code:
Code:
same first file
file 2:
int message1()
{
printf("message");
return 0;
}
int message2()
{
printf("message");
return 0;
}
Program 1 = 12.0kb without upx
Program 2 = 12.1kb without upx
:: I labled each source wrong, it's corrected. : :
-
Ever more precise:
Code:
. <DIR> 04-17-02 2:44a .
.. <DIR> 04-17-02 2:44a ..
A O 2,607 04-26-02 4:09p a.o
A C 80 04-26-02 4:07p a.c
B C 140 04-26-02 4:08p b.c
C C 69 04-26-02 4:08p c.c
B O 2,147 04-26-02 4:08p b.o
C O 1,933 04-26-02 4:09p c.o
PGM EXE 12,411 04-26-02 4:09p pgm.exe
PGM2 EXE 12,383 04-26-02 4:09p pgm2.exe