C Programming and Static Libraries

A vast library is a thing of beauty!

So what is a library?

The process of compiling for a C program.

Static vs. Dynamic Libraries

Making Libraries

$ gcc -c *.c
$ ar -rc libholberton.a *.o
$ ranlib libholberton.a
A peek into a C library…
nm libholberton.a

Using made libraries

  • -l<libraryname without the leading lib or the extension>
  • -L : specifies the path to the library. For the current working directory, we can use -L. If your library is not in your current directory use the path format -L/home/tmp or where ever your library is.
gcc main.c -L. -lholberton -o executable
./executable

--

--

--

Software engineer exploring tech

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Making Stream Processing Accessible to Business Users

Assembling Game Backend Services With AccelByte Augment

High-level overview of Azure IoT services (with .NET demo app)

How WebP image format can help in web performance ?

How the classes and objects work in Python?

Journal Entry #3

Intro to Docker 🚢

How to be a more effective product person: adopt an agile mindset

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tim Mcmacken Jr.

Tim Mcmacken Jr.

Software engineer exploring tech

More from Medium

EXTENSION METHODS in C#

PROGRAMING IN C ++

Binary Search in C++

What You Know About REST Services And Koa JS And What You Don’t Know About REST Services And Koa JS…