pxfgetenv missing

Tobias Burnus burnus@net-b.de
Mon Nov 14 19:14:00 GMT 2011


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



More information about the Fortran mailing list