Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!caesar!blake!milton!uw-beaver!rice!sun-spots-request
From: knutson@perseus.sw.MCC.COM (Jim Knutson)
Newsgroups: comp.sys.sun
Subject: Static sunview library problem
Keywords: Windows
Message-ID: <1717@brazos.Rice.edu>
Date: 26 Sep 89 19:15:24 GMT
Sender: root@rice.edu
Organization: Sun-Spots
Lines: 53
Approved: Sun-Spots@rice.edu
X-Sun-Spots-Digest: Volume 8, Issue 138, message 1 of 3

Description:

There is a problem with using sunview code and any loader which doesn't
know how to deal with shared libraries in SunOS 4.0.*.  In particular,
g++, the Gnu C++ compiler.

The sunwindow static libraries, /usr/lib/sunwindow.a and
/usr/lib/libsunwindow_p.a, contain a reference to __DYNAMIC in the pf.o
module.  Apparently, this is used to test for and implement, shared fonts.
Doing a static load using Sun's loader works because it understands the
__DYNAMIC symbol and takes care of it.

Repeat-By:

	Fix the sunview header files to work for g++.

	Compile the following program

	#include "sunview.h"
	main()
	{
		Frame base;

		base = window_create(0, FRAME, FRAME_LABEL, "hello world!", 0);
		window_main_loop(base);
	}

	% g++ sunview.cc -lsuntool -lsunwindow -lpixrect
	... warning messages ...
	pf.o: Undefined symbol __DYNAMIC referenced from text

Fix:

I reported this to Sun, but they called it a feature, not a bug, so I
don't know if it will ever get fixed by Sun.

To detect which libraries have the problem use:
		nm /usr/lib/lib*.a >/tmp/nm.all
and look for references to __DYNAMIC.  Ideally, there should be none.

There are two ways that I have found to fix the probem.

1. Use ar to remove pf.o from /usr/lib/libsunwindow*.a.  This is ok since
there is another copy in libpixrect.a without the __DYNAMIC reference.

2. Force the loading of the libpixrect copy of pf.o by changing the
library load order.

g++ sunview.cc -lsuntool -lpixrect -lsunwindow -lpixrect

Jim Knutson
knutson@mcc.com
cs.utexas.edu!milano!knutson