Shared Libraries don't work?!

sjm100 at csc.anu.edu.au sjm100 at csc.anu.edu.au
Thu Mar 28 12:14:48 AEST 1991


I have a question about Fortran 1.3.1 and shared libraries.   Of course, I'm
trying to make executable images smaller as they are ridiculously huge with
SunOS.   By the way we are running SunOS4.1 on SPARCstations.

My problem is this :
  when I try the example as given in the SUN Fortran Users Guide (release 16
  March 1990) I find it gives incorrect results, and the executable is not a
  single bytes smaller.

Firstly, perhaps someone can tell me if there is a bug in Fortran 1.3 that
precludes the use of shareable libraries?   If it is meant to work then why does
the following program fail and why is the executable the same size with and
without shareable libraries.

Here is the source code :

File : tessharmain.f

        common /grp/ a,b,c
        a = 1.0
        b = 2.0
        call printgrp
        end

File : blkgrp.f

        blockdata blkgrp
        common /grp/ a,b,c
        data a,b,c /3*9.9/
        end

File : printgrp.f

        subroutine printgrp
        common /grp/ a,b,c
        write(*,'(3f4.1)') a,b,c
        return
        end

I do the following :
                     f77 -c -pic *.f
                     ar cv libblkgrp.sa.1.1 blkgrp.o
                     ranlib libblkgrp.sa.1.1
                     ld -o libblkgrp.so.1.1 -assert pure-text printgrp.o
                     f77 testsharmain.o libblkgrp.so.1.1

Then running it :
                     a.out
                     1.0 2.0 0.0

This is wrong it should be : 1.0 2.0 9.9   - which the non-shareable version
does give.

Any ideas?
                                        Stephen Meatheringham
                                        Applications Programmer
                                        Mt. Stromlo Observatory
                                        CANBERRA, ACT, AUSTRALIA
                                        internet : sjm at merlin.anu.edu.au



More information about the Comp.unix.wizards mailing list