globals in libraries

Jay M. Libove root at libove.UUCP
Fri Oct 7 02:42:00 AEST 1988


[ I know that this is a Sys5 _feature_ and not a bug, but it is of concern
  to the Sys5 audience in general as well as the Xenix audience... ]

It seems that Xenix, and indeed Sys5 in general, are unwilling (in their
default "ar"chiver/library-manager) to store globals in a library as such:

--------------------
/* globaltest.c */

int argle;

void codefunc()
	{
	printf("Hello world\n");
	};
--------------------
/* globaluse.c */

extern int argle;

void main()
	{
	argle=5;
	printf("%d\n",argle);
	};
--------------------

% cc -c globaltest.c
% rm -f archive.a
% ar q archive.a globaltest.o
% ranlib archive.a
% cc -c globeluse.c
% cc globaluse.o archive.a
Undefined external symbols:
argle in globaluse.o(globaluse.c)

This is rather annoying. It has been a problem for me in porting a
number of sources to my SCO Xenix machine (SCO Xenix 80286 version 2.2.1).

So, is this a compiler thing? Does the compiler strip out that global?
I don't think so - the compiler on my system (and probably on most) is
based on pcc. So, is it a /bin/ar thing? I would guess so. Thusly: Does
anyone have a public domain ar replacement?

Sigh. Any help muchly appreciated, net...
-- 
Jay Libove		ARPA:	jl42 at andrew.cmu.edu or libove at cs.cmu.edu
5731 Centre Ave, Apt 3	BITnet:	jl42 at andrew or jl42 at drycas
Pittsburgh, PA 15206	UUCP:	uunet!nfsun!libove!libove or
(412) 362-8983		UUCP:	psuvax1!pitt!darth!libove!libove



More information about the Comp.bugs.sys5 mailing list