delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/30/10:58:39

Message-ID: <20000930145803.69765.qmail@web9907.mail.yahoo.com>
Date: Sat, 30 Sep 2000 07:58:03 -0700 (PDT)
From: Lets Go Canes <letsgonhlcanes AT yahoo DOT com>
Subject: Re: question about linker behaviour
To: djgpp AT delorie DOT com
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Hi all.

--- "Salvador I. Ducros" <sducros AT home DOT com> wrote:
> 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

You need go no further.  In order to assign the address of the function
to the pointer, you (or rather the linker) needs to know the address of
the function.  You can't know the address of the function if you
haven't loaded it from the static library.  Basically, the question
isn't whether or not the function is called, the question is whether or
not it is referenced.  Assigning the address of the function to the
pointer references it.

OTOH, if the functions are in a dynamic library, whether or not the
function gets loaded by assigning its address to a pointer will depend
on the implementation of the dynamic loader.  But I would expect most
would not actually load the code until the function was called.


=====
--------------
Lets Go Canes!

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!
http://photos.yahoo.com/

- Raw text -


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