Thread: Fwd: Retrieving, setting and writing SAC blackboard variables in Fortran

Started: 2006-11-01 17:21:25
Last activity: 2006-11-02 20:11:06
Topics: SAC Help
I'm having trouble with a Fortran program that I inherited, that reads in
information from a text file, makes some calculations, and writes the
results into an existing SAC blackboard file.

The program appears to compile okay (though I have to use the -m32 option in
the makefile as I've recently moved to a 64-bit Linux platform). When I try
to run it, however, it seems to be successful in reading the blackboard
file, but crashes with a "Segmentation Fault" as soon as it gets to the
first "setbbv" command. I've tried writing a short test program or two with
blackboard variables in Fortran - seems that it's okay on subroutines such
as "readbbf" and "getbbv", but always gives a segmentation fault whenever I
write anything that includes a "setbbv".

I tried looking at the example on the SAC2000 user manual, but am none the
wiser. Also having trouble understanding how the getbbv subroutine retrieves
the blackboard variables - no segmentation faults, but I've yet to get a
meaningful answer when I try to use it on an existing BBFILE.

Fiona Darbyshire.

  • Fiona

    This behavior using Fortran with the sacio.a library is a known one
    and only discovered about one month ago. Hopefully this will be
    fixed in the next release.

    A possible workaround is to include the C string terminator at the
    end of your character string in Fortran. In C this character is '\0'
    and I believe it is char(0) in Fortran.

    Cheers,
    Brian


    On Nov 1, 2006, at 9:21 AM, Fiona Darbyshire wrote:

    I'm having trouble with a Fortran program that I inherited, that
    reads in information from a text file, makes some calculations, and
    writes the results into an existing SAC blackboard file.

    The program appears to compile okay (though I have to use the -m32
    option in the makefile as I've recently moved to a 64-bit Linux
    platform). When I try to run it, however, it seems to be successful
    in reading the blackboard file, but crashes with a "Segmentation
    Fault" as soon as it gets to the first "setbbv" command. I've tried
    writing a short test program or two with blackboard variables in
    Fortran - seems that it's okay on subroutines such as "readbbf" and
    "getbbv", but always gives a segmentation fault whenever I write
    anything that includes a "setbbv".

    I tried looking at the example on the SAC2000 user manual, but am
    none the wiser. Also having trouble understanding how the getbbv
    subroutine retrieves the blackboard variables - no segmentation
    faults, but I've yet to get a meaningful answer when I try to use
    it on an existing BBFILE.

    Fiona Darbyshire.

    _______________________________________________
    sac-help mailing list
    sac-help<at>iris.washington.edu
    http://www.iris.washington.edu/mailman/listinfo/sac-help


15:13:47 v.01697673