Static sunview library problem

Jim Knutson knutson at perseus.sw.MCC.COM
Wed Sep 27 05:15:24 AEST 1989


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 at mcc.com
cs.utexas.edu!milano!knutson



More information about the Comp.sys.sun mailing list