Skip to main content
Logo image

Section 28.5 Making Our Own Library - Object File

One typically compiles the source code to an object. This object file contains machine language for all of the functions in the source file but is by itself not executable (since it contains no main() function!).
The library then consists of both the header file and the object file. In our example, this would be
arbitraryintegers.h arbitraryintegers.o
We can now use this library in other programs:
#include <stdio.h>
#include "arbitraryintegers.h"

int main(void) {
  digit_t *myNumber;
  . . . 
  myNumber = readNumber();
  . . . 
}
Note the use of " " for user-defined libraries instead of < >, which is reserved for built-in libraries.