Mail Archives: djgpp/2001/06/08/11:00:21
Orlando P. Hevia <heviaop AT ssdfe DOT com DOT ar> wrote:
>> The difference between libraries and object files is that
>> object files are always linked into the program, while if
>> they are in a library, they are only linked if the linker
>> ``knows'' some code uses the external symbols in that object
>> file.
> Surely. But I think that a FORTRAN BLOCK DATA is not known
> to the linker if it is in a library.
The block data itself is known (as you can see it in the 'nm' output).
What is not known to the linker is that the routine using those data
needs this particular module to be linked in, in the first place. Have
a look at an 'nm' dump of one of the modules using strings from this
block: you'll notice that there is no 'u' or 'U' (for 'undefined')
reference to any of the symbols defined by the block data module.
This is because of the way common blocks work --- no defining instance
of the common block is ever to be present, as far as the linker is
concerned. I think you'll have to follow the actions described in the
"Block Data and Libraries" node of the G77 manual, manually imitating
part of what g77 would do automatically: put a dummy subroutine into
the same module as the block data and explicitly reference that
subroutine from at least one, or preferrably all modules using any of
those data.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -