www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/19/06:40:47

Date: Sun, 19 Apr 1998 13:37:01 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Charles Terry <cterry AT plinet DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: Unresolved externals
In-Reply-To: <353624CC.670E@plinet.com>
Message-ID: <Pine.SUN.3.91.980419133338.23362A-100000@is>
MIME-Version: 1.0

On Thu, 16 Apr 1998, Charles Terry wrote:

> both files compile fine but on the link I get a unresolved external 
> in func testfunc: int nofunc not found.
> 
> So even though there is no calling thread from main to testfunc, 
> since nofunc is include in the link in an .o file the linker insists 
> on resolving it.

Of course, it does!  Do you expect the linker to perform some kind of 
flow analysis of the program's code to see whether there's some thread 
leading to the call?  Well, it doesn't do that.  All it sees is that 
somebody, under some circumstances *might* call nofunc.  So it insists on 
resolving it.

Btw, if you don't care about this problem, if you *know* that no thread 
ever gets to that point, you can run the program anyway, and I think it 
will work just fine.  (I didn't actually try this, though.)

- Raw text -


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