Date: Sat, 30 Sep 2000 14:32:35 +0200 From: "Eli Zaretskii" Sender: halo1 AT inter DOT net DOT il To: "Salvador I. Ducros" Message-Id: <6480-Sat30Sep2000143234+0300-eliz@is.elta.co.il> X-Mailer: Emacs 20.6 (via feedmail 8.2.emacs20_6 I) and Blat ver 1.8.5h CC: djgpp AT delorie DOT com In-reply-to: <39D546B8.2310@home.com> (sducros@home.com) Subject: Re: question about linker behaviour References: <39D546B8 DOT 2310 AT home DOT com> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Salvador I. Ducros" > Newsgroups: comp.os.msdos.djgpp > Date: Sat, 30 Sep 2000 01:49:14 GMT > > My question is basically whether or not the linker (let's say > the DJGPP linker specifically) will include a function from a static > library into an executable if: > > 1. the address of the function is assigned to some function pointer > 2. the function pointer is never actually derefernced > 3. the function is never called by name Yes, the linker will link the function into your program. The reason is that the moment you assign the address of the function (using its name) to a pointer, the linker sees a name of an external symbol that it needs to resolve at link time. > ds->fn1 = A; > ds->fn2 = B; > ds->fn3 = C; This is the point where the linker will know it needs to resolve functions (actually, symbols) A, B, and C.