Mail Archives: djgpp/1997/06/07/19:33:50
>
> If I have certain functions in one program, and want to spawn another
> program that also uses those functions, how could I do that?
>
> Is there a way to use external function definitions, or what? I have
> no experience with memory resident things.... Any help is appreciated.
>
> --
> Michael D. Ryan
A simple thing is to put those reused function in a separate file.
Using the separate compilation, you'll just have to link your both main
files to this third one.
My english is not so clear, so I will explain with an example:
The function yopu want to reuse are a() and b().
The main program files are p1.c and p2.c.
Just move a() and b() from p1.c to a new file named f.c
Just compile, like gcc <options> p1.c f.c
followed by gcc <options> p2.c f.c
Vincent.
- Raw text -