How we add our function in liabrary as liabrary function.
Exp. we want use our int factorical(int); function as int
pow(int,int); function working in math header file.

Answer Posted / ataraxic

First, implement factorial in standalone module
(factorial.c for example).
Then complie it, create an archive and link it with our
program (my.c for example):

Compilation
1. gcc -c factorial.c -o factorial.o

Archiving
2. ar -rcsv libmy.a factorial.o

Compile our prog with new lib
3. gcc my.c -L. -lmy -lm -o my

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is oops c?

598


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

622


Is python a c language?

548


Why do we use c for the speed of light?

600


What is meant by gets in c?

599






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

643


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

647


What does %d do in c?

535


What does double pointer mean in c?

569


What are the different types of control structures in programming?

652


What does p mean in physics?

577


How can I ensure that integer arithmetic doesnt overflow?

602


What is string concatenation in c?

562


What are the 4 types of functions?

561


What does the error 'Null Pointer Assignment' mean and what causes this error?

732