Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner

Cannot compile a fortran file that is dependent on precompile object files

Hello All,

I am trying to compile a file in the Intel Fortran Windows compiler. This file calls multiple subroutines which exist as pre-compiled object files and previously they were linked as a library file using the following command:

pgf90 t22load -L /share/lib $2 $3 -lenglib -o$1

I cannot figure out how can I link the object files or the library in my new project. I have added the picture for more clarity.

 

Thanks.

0 Kudos
5 Replies
Highlighted
Black Belt

Object files generated by

Object files generated by different compilers are, in general, not interchangeable unless you have documentation that describes how to achieve interchangeability and your object files were generated by following that procedure.

If the object files were generated by a PGI compiler, they will probably depend on routines from the PGI Fortran runtime library, and these routines may not be callable from object files produced by the Intel Fortran compiler.

Try to obtain the source codes from which those PGI object files were generated.

0 Kudos
Highlighted
Beginner

I forgot to mention that

I forgot to mention that these object files are c subroutines and were compiled using the pgi compiler to work with Fortran subroutines.

0 Kudos
Highlighted
Valued Contributor II

That makes very little

That makes very little difference: the C compiler will have to be compatible with the Fortran compiler for this to work.

0 Kudos
Highlighted

You apparently are using a

You apparently are using a make file. I suggest you create a static library (xxx.lib) of those files, then add the xxx.lib file as a dependency to your FortranProgram.exe file. In this manner should the xxx.lib change, it will just link the FortranPprogram.exe file.

If you are using Microsoft Visual Studio, then you can add your xxx.lib as a dependency in your Project file.

Jim Dempsey

0 Kudos
Highlighted
Black Belt

Quote:Rehman, Nas wrote:I

Rehman, Nas wrote:
I forgot to mention that these object files are c subroutines and were compiled using the pgi compiler to work with Fortran subroutines.

Object files compiled on Linux are not compatible with the Windows linker. The PGI C compiler is not a "companion processor" for Intel Fortran on Windows. You will have to recompile the C sources using VC or Intel C.

0 Kudos