delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/07/19:33:50

From: "POULAIN Vincent" <vpoulain AT club-internet DOT fr>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Using EXTERNAL Functions??
Date: 31 May 1997 01:01:33 GMT
Organization: Grolier Interactive Europe
Lines: 28
Message-ID: <01bc6d59$4669ff80$LocalHost@vpoulain>
References: <338d395e DOT 1295572 AT usenet DOT nau DOT edu>
NNTP-Posting-Host: ppp-102-132.villette.club-internet.fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


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


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019