[comp.windows.interviews] Shared libraries / InterViews

bruss@odin.ucsd.edu (Brian Russ) (04/17/91)

	(This may not be quite the right place for this, as the question
concerns shared libraries more than InterViews, but ...)

	We are developing several applications with InterViews 2.6.  As
the compile times and executable sizes increased, we started to wonder
whether shared object files would solve some of our problems.  Several
of the executables are several meg in size, and it seems like a lot
of that size is either libInterViewsX11.a itself, or our collections
of graphics classes built on top of InterViews.  Also, several of these
applications would be running concurrently, so a 8 or 16 meg Sun
(Sparcstation) starts spending a lot of time swapping.

	So, the questions are:

	(1)  Would shared libraries help at all?

	(2)  Can libInterViewsX11.a be converted into a shared library?
	     How?

	(3)  Can our user libraries (just collections of C++ classes
	     derived from InterViews) be converted into shared libraries?
	     How?

	(4)  Are there any guidelines about what can and can't be shareable?
	     I think the general idea is that code that uses global or
	     static data is out, but I may be over-simplying this, or maybe
	     I'm just plain wrong.

	Thanks for any help ...

					Brian

-- 
Brian Russ
CSE Department, UC San Diego
..!sdcsvax!bruss	bruss@beowulf.ucsd.edu

dag@control.lth.se (Dag Bruck) (04/18/91)

In article <18377@sdcc6.ucsd.edu> bruss@odin.ucsd.edu (Brian Russ) writes:
>	(1)  Would shared libraries help at all?

Yes, it helps tremendously.  It cuts down on the size of the
executable and on link time.

>	(2)  Can libInterViewsX11.a be converted into a shared library?
>	     How?

I compiled all modules with `-pic', linked them with `ld -assert
pure-text' and that was it!  The modules compiled with `-pic' and be
stored in an .a file as well.

>	(3)  Can our user libraries (just collections of C++ classes
>	     derived from InterViews) be converted into shared libraries?
>	     How?

Possibly, but consider the constraints of shared libraries.

>	(4)  Are there any guidelines about what can and can't be shareable?
>	     I think the general idea is that code that uses global or
>	     static data is out, but I may be over-simplying this, or maybe
>	     I'm just plain wrong.

I haven't quite understood this myself, but you are probably close.   For
example, AT&T's iostream library needs some "fixing" to be compiled as
a shared library.

I have used shared libraries on Sun-3/4 running SunOS 4.0.3 and 4.1;
we have used AT&T's compiler version 2.0.1 and 2.1.

		-- Dag