delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/20/07:31:40

From: Charles Terry <cterry AT plinet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Unresolved externals
Date: Sun, 19 Apr 1998 08:21:20 -0700
Organization: All USENET -- http://www.Supernews.com
Lines: 39
Message-ID: <353A1670.36BC@plinet.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980419133338 DOT 23362A-100000 AT is>
NNTP-Posting-Host: 207.174.3.140
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Eli Zaretskii wrote:
> 
> 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.)
The error is exactly what I expected.
The original poster was looking for a way to check
for unresolved externals in a library he was constructing.
I suggested that before he built the library, he include all
of its object files in an .exe since the linker will treat
all of the object files as needing to be resolved,  then if
there are no errors put them in a library. The post you picked
up on was a reply to someone, sayin that it wouldn't work, that
the linker would process the object files like it does a
library and only resolve what it needed based on calling threads.

BTW I don't think I could run the program as the linker 
reported the unresolve linkage as an error, not a warning.
Is that right?
Also, is there a utility other than CASE tools or such that would
peform the check described above?

Charles Terry

- Raw text -


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