Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

HOW CAN ADD OUR FUNCTION IN LIBRARY.

Answer Posted / ataraxic

Using ar utility.
Let's say we have lib1.c lib2.c and myprog.c
We want to do a library from lib1.c && lib2.c, and compile
myprog.c with this library afterwards.
The steps are:
Compile
1. gcc -c lib1.c -o lib1.o
2. gcc -c lib2.c -o lib2.o

Create archive named libmy.a
3. ar -rcsv libmy.a lib1.o lib2.o

Compile myprog with newly created lib
4. gcc myprog.c -L. -lmy -o myprog

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is an auto keyword in c?

1099


What is indirection?

1095


Here is a good puzzle: how do you write a program which produces its own source code as output?

1104


What is the Purpose of 'extern' keyword in a function declaration?

1084


What is the c language function prototype?

1086


How do you list a file’s date and time?

1071


What's the total generic pointer type?

1055


What is a stream in c programming?

1155


Why clrscr is used after variable declaration?

1693


What language is lisp written in?

1269


What is an identifier?

1036


How many types of sorting are there in c?

1061


How many levels of pointers have?

1056


Explain how can you tell whether two strings are the same?

1018


What is the use of #include in c?

1087