[net.bugs.4bsd] Load order problem with ioinit

donn@sdchema.UUCP (Donn Seeley) (02/24/84)

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