Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!odi!mlm
From: mlm@odi.com (Mitchell Model)
Newsgroups: comp.windows.x
Subject: Re: Linking Libraries/Undefined variables
Message-ID: <1989Aug15.214447.3156@odi.com>
Date: 15 Aug 89 21:44:47 GMT
References: <12086@orstcs.CS.ORST.EDU> <13489@bloom-beacon.MIT.EDU>
Organization: Object Design, Inc.
Lines: 35
In-reply-to: jstravis@athena.mit.edu's message of 14 Aug 89 22:58:42 GMT

In article <13489@bloom-beacon.MIT.EDU> jstravis@athena.mit.edu (John S. Travis) writes:

   1)why does the order of linking libraries affect stuff? I changed the places
   of Xw and Xt on young's oneline textwidget and got this. (compile calls
   the gnu cc).

My theory is the following:

Since widget libraries are based on Xt, they make calls on functions
in libXt, and functions in libXt don't make calls to them.  With the
libraries specified in the wrong order, after the loader finishes
getting what it needs from libXt, it then encounters calls to libXt in
the widget library that it didn't know about when it processed libXt.
The only reason the larger program happened to work is that it itself
called all the Xt functions that the selected pieces of the widget
library called; larger programs tend to call a wider variety of
functions!

The same reasoning tells you to put -lX11 after -lXmu and -lXmu after
-lXt.

	Mitchell L Model
	Director, HeadStart Program
	Object-Design, Inc.
	One New England Park
	Burlington MA 01803
	(617) 270-9797
	mlm@odi.com


-- 

	Mitchell L Model
	Director, HeadStart Program
	Object-Design, Inc.