delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/08/01/08:34:37

From: jazz AT softway DOT com (Jason Zions)
Subject: Re: Where are Reg* implemented?
1 Aug 1997 08:34:37 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <33E1F632.1B2D.cygnus.gnu-win32@softway.com>
References: <199708010304 DOT XAA31283 AT solid DOT ssd DOT ornl DOT gov>
Reply-To: jazz AT softway DOT com
Mime-Version: 1.0
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: Wei Ku <weiku AT UTKUX1 DOT UTK DOT EDU>
Original-CC: gnu-win32 AT cygnus DOT com, Justin Hopkins <hop AT elwood DOT pionet DOT net>
Original-Sender: owner-gnu-win32 AT cygnus DOT com

> My impression ( an what I always do ) is to put the options before the
> files to be compiled or linked as following:
> 
> g++ -o outfilename -O -L libpath -l lib file.c file.o ...

Usually won't work. *Most* options need to go up front; -O, -L, etc.

Library options (-l) *must* be specified in the *correct order* so that
resolution can be controlled. By listing a library, -lfoo, before any .o
files have been loaded, you're trying to resolve entrypoints from the
library before the loader has seen any unresolved names.

First list the .o files, then the libraries you want the loader to use
to resolve entrypoints, in the order you want it to try. If two
libraries both have a particular entrypoint, the first one the loader
sees (once it sees the unresolved name from another file) is the one it
loads, and it silently ignores the latter one (because the name has
already been resolved).

This is basic stuff, folks. Read a Unix system's "ld" man page.

Jason

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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