- or download this
$ cat lib_int.c
int compare_int(const void *a, const void *b) {
...
$ gcc -c -o lib_double.o lib_double.c
$ ar cr libtypes.a lib_int.o lib_double.o
- or download this
$ cat foo.c
#include <stdio.h>
...
$ gcc foo.c -DDO_DOUBLE -L. -ltypes -o foo_double
$ gcc foo.c -DDO_INT -DDO_DOUBLE -L. -ltypes -o foo_both
- or download this
$ ./foo_int
1, 5, 25, 50, 100,
...
0000000100403050 R .refptr.compare_int
0000000100401230 T compare_double
0000000100401210 T compare_int
- or download this
$ cat foo.c
#include <stdio.h>
...
1, 5, 25, 50, 100,
1.000000, 5.000000, 10.000000, 25.000000,