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.



How we add our function in liabrary as liabrary function. Exp. we want use our int factorical(int);..

Answer / 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

More C Interview Questions

struct node { int *a; char *b; char array[12]; }; struct node m,*n; assign the value in *a,*b,char array[12]

3 Answers  


f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=?

7 Answers   Geometric Software,


Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.

0 Answers  


What is an expression?

1 Answers  


What is the use of clrscr?

1 Answers  


How do you list files in a directory?

1 Answers  


advantages of pointers?

3 Answers  


What are global variables?

1 Answers  


write the function int countchtr(char string[],int ch);which returns the number of timesthe character ch appears in the string. for example the call countchtr("she lives in Newyork",'e') would return 3.

6 Answers  


how to multiply two number taking input as a string (considering sum and carry )

2 Answers   Wipro,


What is a class?

3 Answers  


What are register variables in c?

1 Answers  


Categories