archiving block data subroutines...

Bill Silvert silvert at cs.dal.ca
Mon Oct 22 23:01:43 AEST 1990


In article <1990Oct22.033107.5159 at ux1.cso.uiuc.edu> jeffb at aquifer.las.uiuc.edu (Jeffrey Biesiadecki) writes:
>We have a library written in Fortran77 which includes a block data
>subroutine.  If we use "ar" to archive the object files of the library,
>and then try to compile a program using the resulting "lib???.a" file,
>everything works fine EXCEPT the block data subroutine is never executed
>(that is, the initializations are not made).  If the block data object file
>is linked in explicitly with the fortran compiler, then the initializations
>are done.

This is a common (:)) problem which arises from the fact that the linker
looks only for subroutines that are called, and since block data is not
called, it doesn't get linked.  One sure fix is to combine the block
data unit with a subroutine in one file, since the entire file with
both units will then get loaded if the subroutine is called.
-- 
William Silvert, Habitat Ecology Division, Bedford Inst. of Oceanography
P. O. Box 1006, Dartmouth, Nova Scotia, CANADA B2Y 4A2.  Tel. (902)426-1577
UUCP=..!{uunet|watmath}!dalcs!biomel!bill
BITNET=bill%biomel%dalcs at dalac	InterNet=bill%biomel at cs.dal.ca



More information about the Comp.sys.sgi mailing list