This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: pxfgetenv missing
- From: Tobias Burnus <burnus at net-b dot de>
- To: Jennifer Brauch <jbrauch at senckenberg dot de>
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 14 Nov 2011 20:14:20 +0100
- Subject: Re: pxfgetenv missing
- References: <4EBD10DB.8060605@senckenberg.de>
Jennifer Brauch wrote:
I run a fortran modell which needs an etxra module. So I compiled both
with the same compiler (gcc_4.4.5 and gcc_4.6.1).
When I link the two together, I get this error:
getEnvironment.F:(.text+0xc4): undefined reference to `pxfgetenv_'
Now I'm lost. pxfgetenv should be part of gcc as far as I understood it.
pxfgetenv is not part of the Fortran standard. However, it is part of
the IEEE Standard 1003.9-1992, which has been withdrawn. This 1003.9
specifies POSIX bindings for Fortran.
There is a long-standing plan to implement those bindings for gfortran,
however, other features had a higher priority, especially as one can
implement those in external libraries.
For PXFGETENV, 1003.9 specifies:
SUBROUTINE PXFGETENV (NAME, LENNAME, VALUE, LENVAL, IERROR)
CHARACTER*(*) NAME, VALUE
INTEGER LENNAME, LENVAL, IERROR
It can be replaced by gfortran's vendor extension:
| CALL GETENV(NAME, VALUE)|
if one ignores the IERROR and removes the length values.
It can also be replaced by the Fortran 2003 intrinsic
GET_ENVIROMENT_VARIABLE, cf.
http://gcc.gnu.org/onlinedocs/gfortran/GET_005fENVIRONMENT_005fVARIABLE.html
As Arjen mentioned, there are also compiler-independent libraries, which
implement POSIX bindings; I don't know how complete or compatible are those.
See: http://gcc.gnu.org/wiki/GFortranStandards#POSIX (last words of the
POSIX section).
Tobias