Library Compatibility - gfortran and pg compilers (on OS/X)

I recently installed the community edition and am setting up a OS/X development environment for a faculty member.

His code has a number of library prerequisites. These were compiled with gfortran and link fine with a gfortran main program. They are giving errors when trying to link with pc fortran main program.

Is this at all possible? Or am I going down a dead end road?

— Dave

ps. I would have compiled all the prerequisites with pg compilers, but some of them won’t compile.

The short answer to compatibility between pgfortran and gfortran
(and intel fortran) is that they are not compatible.

The longer, more technical answer is that if the fortran routine
called from a different compiler had all of its arguments as pass
by reference fortran 77 type, and had no I/O stmts in them
(since the compilers maintain their own internal logical unit numbers).
The only problem would be the entry symbols

subroutine foo()
in fortran creates the entry point foo__ in pgfortran, while gfortran
probably calls the entry point foo_ . So you may need to write a C procedure called foo__ to call from pgfortran to pass arguments to gfortran foo_ .

This is sort of the thing ISO_C_BINDINGS helps do in a universal way.

The ability to link different fortran compiler objects is very restrictive,
and usually it is easiest to build the library with pgfortran. But it can
be done.


Thank for the quick reply!