DEV Community

All you need to know about C Static libraries

Khalil on September 04, 2020

Introduction Before starting to talk about the subject matter, let us take a brief look at the compilation phases of a C program. There...
Collapse
 
leemarvin94 profile image
ONDO ABAGHE Rooly Marvin

The content is so clear and concise, thanks a lot

Collapse
 
yacoubo00975961 profile image
yacoubou

Good content thank

Collapse
 
rnrnshn profile image
Olimpio

Thanks for this amazing article

Collapse
 
canhamzacode profile image
Hamzat Abdul-muizz

Thanks so much well detailed explanation

Collapse
 
peacecole profile image
Otieno Onyango

Could you please say something about the content of the add.c and the mul.c, for a beginner like me, that is. Otherwise, great content here

Collapse
 
iamkhalil42 profile image
Khalil

As mentioned above, add.c and mul.c are files that contain a single function that makes the addition or the multiplication of two integer values. You can think of them as follow:

/* add.c */
int add(int a, int b) { return a + b; }

/* mul.c */
int mul(int a, int b) { return a * b; }

I hope this answers your question :)

Collapse
 
shamsutukor profile image
Shamsuddeen Abdullahi

I am a beginner too. But I found it the hard way, weldone!!!

Collapse
 
dohoudaniel profile image
Dohou Daniel

I read this in 2022, and came back for it in 2023.
That is to make you understand that this was really helpful, and also a well-detailed explanation.
Thank you 💚.

Collapse
 
geff115 profile image
Gabriel Effangha

I understand static libraries now, thanks to you.

Collapse
 
endygrit profile image
Endurance Edward

Succinct 👌

Collapse
 
davidngozichukwuka profile image
David-ngozichukwuka

This article covers every important detail on static libraries and simplifies these concepts. Impressive material

Collapse
 
musiliyrn profile image
Code warrior

Thank you for this amazing post.May you please do one for Dynamic libraires?

Collapse
 
noble_93 profile image
Itumeleng-Malgas

Awesome stuff

Collapse
 
bereketmelese profile image
Bereket-Melese

Concise and to the Point. Keep up the good work.

Collapse
 
hossam43 profile image
Hossam Ayman

Thank you. That was an amazing explanation.

Collapse
 
gibexz profile image
Esogibe Chidubem Andrew

Great explanation. Just cleared my little confusion with ease. Thanks Dev.

Collapse
 
demmythetechie profile image
Demmythetechie

Nice article bro, shows you are very good at what you do.
Thanks for the help, I understood in a Jiffy.

Collapse
 
nathan88 profile image
Onwuka Chukwuebuka Nathan

Nice 👍

Collapse
 
pweetyaries profile image
pweety_aries

thanks …. it well explanatory

Collapse
 
chukwu1455 profile image
Chukwuemeka Ejiofor

This was really insightful. Thanks 👍

Collapse
 
chuks24011850 profile image
XNFTS_Chuks💎

I really learned and enjoyed a lot of ideas shared here thanks so much

Collapse
 
hayatscodes profile image
Hayatudeen Abdulrahman

Thank you for this. I really needed it for my project

Collapse
 
pentacular profile image
pentacular

I think it is worth noting that libraries are not part of the C language.

Which means that they are all implementation features and vary between compiler and system.

The description of libraries here seems to be for gcc libraries under linux?

Collapse
 
iamkhalil42 profile image
Khalil

Yes, you're right. The C libraries aren't part of the language.
It slipped my mind. Maybe I'll add it. Thanks for your feedback.

And yes I've used the GCC compiler on Linux. but the same principle applies to other platforms.

Collapse
 
pentacular profile image
pentacular

You're welcome.

Collapse
 
darthjade-i profile image
Solomon Ovie Okomowho • Edited

As a beginner learning C programming, I found this article quite enlightening. It was direct and gave the necessary information needed to start practising making use of libraries straight away. Thank you.

Collapse
 
valeryio profile image
Valeryio

Succint, but, what is the difference between libname, and the module add.c and mul.c ?
Here you include "header.h", and without libname.a, it will also compile and work.

Could you give me more explanations, please?

Collapse
 
amr89mohamed profile image
amr89mohamed

great they give me a lot of materials on my course to understand the static libraries but in the end I understand nothing, I found your article on Google and it's really good, I get the idea and understand what to do, thanks

Collapse
 
samlan profile image
samlan

Thank you for this.

Collapse
 
creih profile image
cReih

How I'd wish for all internet resources to be as instructionally detailed as this one.

Collapse
 
tsui profile image
stone

Very good explanation and useful guideline to those who found this web on purpose

Collapse
 
horla profile image
Idowu

Well explained

Collapse
 
lovescv26 profile image
lovescv26

Could you please say something about the content of the header.h

இ௰இ

Collapse
 
debaycisse profile image
Azeez Adebayo

What a well-detailed explanation!.
Thanks a lot.