Article View: net.lang.f77
Article #296Re: Attempts at accessing signal(2) from within f77
From: Guy Harris
Date: Sat, 25 Jan 1986 09:48
Date: Sat, 25 Jan 1986 09:48
37 lines
2216 bytes
2216 bytes
> In intro(3) it says "these functions together with those from section 2
> are automatically loaded by cc and f77". I took this to be reason enough
> that I could access signal(2) from a Fortran 77 program. Someone pointed
> out that "Ah yes! Loaded but not accessible" Huh? Can a clear explanation
> be given.
You can't call a section 2 or 3 C library routine from FORTRAN. A FORTRAN
call to "foo" would be a call to a C routine called "foo_", and there's no
way to generate a call to a C routine called "foo". As such, you can't get
at "signal(2)" from a FORTRAN program.
> A small test program (after several lager ones failed) was quickly written:
>
> external junk,signal
> call signal(SIGFPE,junk)
...
First, put away the lager - never program when drunk. :-) The problem with
this is twofold:
1) SIGFPE is not declared, and in the grand (yecch) tradition of
FORTRAN, this means it creates a REAL variable (assuming no
"implicit" statement) - uninitialized, of course - and passes
its address as the first argument either to a FORTRAN routine
"signal" or a C routine "signal_".
2) According to the 4.2BSD manual, the FORTRAN routine "signal"
(actually implemented as a C routine "signal_" takes three
arguments, not two. 4.1BSD may be the same; I don't know.
Look in your manual for a section on FORTRAN library routines;
"signal" will probably be in something called "signal(3F)".
This manual page will give more details on how to use "signal"
from FORTRAN.
--
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy%gorodish@sun.arpa (yes, really)
Technical Details
Message-ID:
<3193@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!sun!guyReferences:
<611@eagle.ukc.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.lang.f77 Subject: Re: Attempts at accessing signal(2) from within f77 Message-ID: <3193@sun.uucp> Date: Sat, 25-Jan-86 04:48:39 EST Article-I.D.: sun.3193 Posted: Sat Jan 25 04:48:39 1986 Date-Received: Sun, 26-Jan-86 06:01:40 EST References: <611@eagle.ukc.UUCP> Organization: Sun Microsystems, Inc. Lines: 37