Mail Archives: djgpp/1998/04/19/06:40:47
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 -