Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site sdchema.UUCP
Path: utzoo!linus!decvax!ucbvax!sdcsvax!sdchema!donn
From: donn@sdchema.UUCP (Donn Seeley)
Newsgroups: net.bugs.4bsd
Subject: Load order problem with ioinit() in F77 libraries
Message-ID: <1059@sdchema.UUCP>
Date: Thu, 23-Feb-84 20:44:04 EST
Article-I.D.: sdchema.1059
Posted: Thu Feb 23 20:44:04 1984
Date-Received: Sat, 25-Feb-84 03:49:41 EST
Organization: Used Softwear Jobbers, Inc. (Clandestine Computer Services)
Lines: 66

Subject: Load order problem with ioinit() in F77 libraries
Index:	usr.lib/libI77/ioinit.f 4.2BSD

Description:
	The new F77 I/O library routine ioinit() is very useful but
	unfortunately it has the problem that it wants to use
	subroutines from the run-time library, and the run-time
	library is loaded ahead of the I/O library.

Repeat-By:
	If you compile the program 'iotest.f' as in the script below,
	you get the results shown:

	----------------------------------------------------------------
	% cat iotest.f
	c
	c	iotest.f -- check load order of ioinit()
	c
		logical n
		logical ioinit

		n = ioinit( .true., .false., .false., 'FORT', .false. )

		stop
		end
	% f77 -O iotest.f
	iotest.f:
	   MAIN:
	Undefined:
	_i_len
	_i_indx
	_lnblnk_
	_s_cmp
	_s_copy
	%
	----------------------------------------------------------------

	More complex programs probably don't have this problem -- they
	load all of the routines needed by ioinit() anyway, because
	they need them elsewhere.  However a reasonably complex program
	which one of our users was trying to bring up still failed to
	load a few of the required routines.

Fix:
	I scratched my head with this one.  I have decided not to offer
	a real fix and let the authorities decide how to deal with it.
	There are a number of conceptual problems (e.g, ioinit.f is
	supposed to be a model F77 subroutine, but it won't work in the
	F77 I/O library because it calls run-time subroutines like any
	good F77 program should, so perhaps it should be rewritten in
	C; or perhaps the run-time and I/O libraries should get loaded
	together; etc.).  A hack that makes the problem go away is the
	following:

	----------------------------------------------------------------
	# cd /usr/lib
	# ar xv libI77.a ioinit.o
	x - ioinit.o
	# ar rv libF77.a ioinit.o
	a - ioinit.o
	# ranlib libF77.a
	# rm ioinit.o
	----------------------------------------------------------------

Donn Seeley    UCSD Chemistry Dept.       ucbvax!sdcsvax!sdchema!donn
32 52' 30"N 117 14' 25"W  (619) 452-4016  sdcsvax!sdchema!donn@noscvax