Mail Archives: djgpp/2001/06/08/16:29:41
L. Broeker 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
This is that I done converting the block data to dummy
subroutine, as first solution.
Now, I added a dummy subroutine in the same FORTRAN file,
and converted all to C with f2c. This solution is more
elegant, and may be the definitive one.
The limit is not in ar, it is in my knowledge.
Thanks you.
OPH. 2001-6-8 17:27
Ing. Orlando P. Hevia
heviaop AT ssdfe DOT com DOT ar
Santa Fe-Argentina
- Raw text -