call functions from diferents programs

hi

i have ten program in C, and there are functions what are in all the programs.

so, i want to make a directory to store all the functions what are in all the programs, and call them from the C programs. (sending variables and values)

is that possible?�? how ca i do that?�?
any idea, thanks

jona

You are saying that you have the same identical functions repeated.

move a copy of all of those functions into a separate file, like myfunctions.c
Be sure to add all of the headers (#include <> and #include "") statements you need.

Next be sure the ten source code files have the functions declared as prototypes
eg., int myfoo( char *, int); or whatever. The easy and best way is to put these prototypes in an .h file
-- let's call it myfunctions.h

In each of the ten source code files be sure to have:

#include "myfunctions.h"

in all ten files near the top.

Strip the repeated functions out of the ten source code files.

You now have choices about how you get the ten files to use the functions. One choice is to compile myfunctions.c into an object file:

cc -c myfunctions.c

this creates myfunctions.o

Then compile each of the ten source code files like this-- with myfunctions.o and myfunctions.h in the current working directory:

cc -I. fileone.c myfunctions.o -o /path/to/exectuable/fileone
...
cc -I. fileten.c myfunctions.o -o /path/to/exectuable/fileten