[comp.windows.x] SunOS4 Xlib shared library

ins_ajsk@jhunix.HCF.JHU.EDU (Jon Kay) (09/08/89)

Those of you with Suns running SunOS 4.whatever might be interested in
the following:


I recently created an SunOS shared library out of Xlib, and it seems
to work really nicely.   I have a 4-meg Sun 3/60, so memory is a
really sore point with me.  Clearly paging is way down now.
Each executable I've compiled grew smaller by 60-100K after compiling
with the Xlib shared library, plus the commonly used Xlib code pretty
much stays in memory.

I went about it in a very simple-minded way: I simply used
make CC="cc -pic -O2"
rm libX11.a
ld *.o -o libX11.so.11.3
in the lib/X directory and installed libX11.so.11.3 in /usr/lib.
I did NOT perform the separation of modified and never-modified
initialized data recommended in the manuals; that would have taken a
long time and there isn't much data in the Xlib in any case.  I also
"sharified" libXt.a and libXaw.a, but those seem to be losing choices;
nothing I've compiled so far uses them except for xterm.  Mileage on
those may vary, though.... 

If anybody decides to do it "right" or comes up with some other
improvement, please let me know....


					Jon Kay

"What am I doing?"
		-A JHU Math professor who shall remain nameless.

carlson@lance.tis.llnl.gov (John Carlson) (09/12/89)

In article <2465@jhunix.HCF.JHU.EDU> ins_ajsk@jhunix.HCF.JHU.EDU (Jon Kay) writes:
>Those of you with Suns running SunOS 4.whatever might be interested in
>the following:

>I went about it in a very simple-minded way: I simply used
>make CC="cc -pic -O2"
>rm libX11.a
>ld *.o -o libX11.so.11.3
>in the lib/X directory and installed libX11.so.11.3 in /usr/lib.

>If anybody decides to do it "right" or comes up with some other
>improvement, please let me know....

Here's what I did.  I don't think it's "right" yet, you still have
to do some kind of install (move lib.so to something useful):

Made changes to Sun.macros:

******  AR command will create both a static and dynamic library.
******  This is really gross.  I don't really recommend it; it's just
******  a quick way to avoid changing Imake rules.

37c37
<              AR = ar clq
---
>              AR = $(LD) -o lib.so -assert pure-text $(OBJS); ar clq

****** Sun OS 4.0 lint has options opposite SYS V

39c39
<        LINTOPTS = -axz
---
>        LINTOPTS = -bh

******
******  In the Imakefile for many libraries, you can find
******  "STD_DEFINES = LibraryDefines".  Unfortunately,
******  the newest kid on the block, XView, doesn't
******  include this.  Perhaps they have another way
******  to get shared libraries.
******
******  Anyway, this is probably another kludge.
******

50c50
< #define LibraryDefines
---
> #define LibraryDefines -pic

Anyway, back to the drawing bored.

John "X11:  200MB and climbing..." Carlson
carlson@tis.llnl.gov

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (09/12/89)

FYI, SunOS shared library support will be in R4 (for Xlib, Xt, Xaw, ...).