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 a program flowchart and how does it help in writing a program?

643


How can I find out the size of a file, prior to reading it in?

608


the portion of a computer program within which the definition of the variable remains unchanged a) mode b) module c) scope d) none

635


Why should I prototype a function?

624


Is there a way to jump out of a function or functions?

620






Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

1583


Explain what are its uses in c programming?

581


What is the function of multilevel pointer in c?

660


What are the data types present in c?

614


What are the preprocessor categories?

625


What is bin sh c?

567


This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory

717


What is variable declaration and definition in c?

487


#include int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20

1245


Write a client and server program in C language using UDP, where client program interact with the Server as given below: i) The client begins by sending a request to send a string of 8 characters or series of 7 numbers, the server sends back a characters or numbers as per the request of the client. ii) In case of series of 7 numbers: The client sends a multiplication of numbers, to the server. iii) In case of a string of 8 characters: The client sends a reverse order of string to the server.. iv) Server will send an acknowledgment to the client after receiving the correct answer

3827