Dynamic vs Static Linking of X11 Code on Sun Sparc

George W. Fleming gwf at sapphire.bellcore.com
Thu Jan 24 07:47:43 AEST 1991


I have a Sun Sparc running OS 4.1.1, with X11R4 (PL18) and Motif 1.1.  The
X11 system was built to provide shared libraries...

I've noticed that some X11/Motif codes that I write would occasionally
produce the following error:

  ld.so:  Undefined Symbol:  __XtInherit

I don't know why it is using XtInherit in the first place.  When I look in
the source code of X11, I noticed a comment in there that says that
XtInherit should be linked statically.  So I tried it with the -Bstatic
option.  Sure enough, it worked!

Of course I don't know what made it to work since I don't understand the
difference between static and dynamic linking.  Could someone shed me some
light on this?  Since I don't understand it, I don't know if all my
X11/Motif codes should be compiled with the -Bstatic option.  If not, how
do I know when XtInherit will be referenced?

If the library is shared, why do I need to make it static?  Any info would
be appreciated.

George W. Fleming
gwf at sapphire.bellcore.com



More information about the Comp.sys.sun mailing list