Appendix D

Creating Static Library with gcc

A static library is a set of functions, which are resolved in a caller at compile time and copied into a target application by a compiler or linker, producing an object file and a standalone executable. All the predefined functions that we use through header files like stdlib.h are part of static libraries. In this article, we will look into the process of creating such static libraries of our own using the GNU C compiler and related utilities, available both for Linux and Windows1. Another feature of a static library is its pre-compiled nature. This enables the programmer to distribute the library without having to include the source files. Think of it as something like the printf() function. We use ...

Get C Programming Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.