c programing with PGI Fortran

The two language program runs fine with c works as a project of external lib and compiles with 64bit option. The code was created using 64bit option.

But it cannot be compiled using 32bit option anyway. The c project compiles, the fortran doesn’t. An error always: “Unable to open MODULE file xxxxx.mod”.

Hi Jia-olemiss,

The c project compiles, the fortran doesn’t. An error always: “Unable to open MODULE file xxxxx.mod”.

Did you remove the 64-bit module files between the two compilations?

  • Mat

Yes.
This happened after both projects have been cleaned under “Build”.
Clean solution and then rebuild solution have been tried and lead the same error.

The compiling would have no problem if I simply switch back to 64bit.

Do you have a the standard procedure for switching 32 and 64bit compiling, particularly with external c lib?

Hi Jia-olemiss,

Unfortunately, we’re not sure what going. There shouldn’t be any difference in the build process between 32 and 64-bit.

Some questions:
Does your code create the Fortran module when the Platform is switched to Win32?
When the Platform selected is x64, where does the module file get created?

The normal practice for creating the 32-bit platform from a 64-bit platform configuration is just to select in the Platform drop-down. Can you open the Configuration Manager to check that each project has the appropriate Platforms?

  • Mat

Matt,
The code only compile existing Fortran modules and external c subroutines in the compiling process.

Fortran and c are two projects.
The Configuration Manager looks OK:
Active solution platform: Win32
Below this, the platform for both fortran and c are Win32.

I made a new copy of the 64bit code and recompiled after a thorough clean. The error now is changed.

The c lib file compiling alone with Win32 has no error.
With a full path or a relative path (…\Release\cxxx.lib) in the linker to the lib file, compiling the Fortran project resulted “unresulved external symbol_F2C_xxxx@52 referenced in function _xxxx…” for all c subroutines defined in the c lib.
The same error appeared even when no path is set.

It will show: "cannot open input file ‘…/xxxx/xxx/xxx.lib’ " if the file path or name is set wrong.

Ok, so the first problem was some type of environment issue.

external symbol_F2C_xxxx@52 referenced in function _xxxx…" for all c subroutines defined in the c lib.

You need to get your Win32 calling conversions to match.

Please review Chapter 15 of the PVF User’s Guide: http://www.pgroup.com/doc/pvfug.pdf

Also, Chapter 10 of the PVF Reference Guide may be helpful: http://www.pgroup.com/doc/pvffortref.pdf

If you have questions, please let us know.

  • Mat