/libonexe

Demo a pair of inter-dependent library and executable

Primary LanguageCGNU General Public License v3.0GPL-3.0

libonexe

Simple project to demo a library (libsum.a) and an executable may be inter-dependent.

Outline:

prog.c defines mean(int, int) and calls the function sum(int, int) which is defined in the library.

calc_sum.c defines sum(int, int) which calls mean(int, int).

Run the following commands:

/* Generate the static library libsum.a */
gcc -c calc_sum.c -o calc_sum.o
ar rcs libsum.a calc_sum.o

/* Compile the main program statically */
gcc -static prog.c -L. -lsum -o prog

Command ref: http://www.adp-gmbh.ch/cpp/gcc/create_lib.html