Linking: Resolving the unresolved function

First the function has to be written and compiled into an object code file. Then it can be put into an archive (library) which is added to the compilers commandline.

in myfunction.c:

int myFunction(char*, int) {
  return 1;
}

This file gets compiled with gcc -c myfunction.o which looks like this when viewed with nm myfunction.o : 00000000 b .bss 00000000 d .data 00000000 t .text 00000000 T _myFunction . Note that myFunction now as a "T" in front meaning that it is defined and resides in the text segment of a program, currently at address 0