Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

FORTRAN 64Bit Project

Alemdar__Bulent
Beginner
719 Views

Hello

I have been working on porting several 32bit projects to 64bit platform. Tthe main program is a C\C++ project and it calls  Fortran functions (similarly, some of Fortran functions call C\C++ functions as well).  Projects compile and link juts fine for 32x.  Once, I change it to  it to 64x, I am getting lots of unresolved external symbol errors like this one

1>Interface_Linear_Direct_Integration_X.obj : error LNK2019: unresolved external symbol Print_decomp_message referenced in function "void __cdecl monitorf(class AG_SparseSymMatrix *,void *)" (?monitorf@@YAXPEAVAG_SparseSymMatrix@@PEAX@Z)

1>Interface_X.obj : error LNK2001: unresolved external symbol Print_decomp_message

And, the Fortran function "Print_decomp_message" is defined like this:

 SUBROUTINE Print_decomp_message(IMSG,NEQN,DIAG_NEW,DIAG_OLD)
 !MS$ATTRIBUTES c,alias: '_Print_decomp_message'::Print_decomp_message  

 

I am using MS VS2013 and Intel Fortran (Parallel Studio XE 2015 Composer Edition, for Fortran Windows). I am guessing that this problem is somehow related to function name decorating (mangling) but I could not figure it out yet. 

 

I am not quite familiar with Fortran language so any help, suggestion, or reference to some materials documents are greatly appreciated. 

 

Regards

Bulent

 

 

 

 

 

 

0 Kudos
1 Solution
Lorri_M_Intel
Employee
719 Views

While using the standard iso_c_binding mechanisms would be *best*, this is the quickest solution to get you going.

change this:

 !MS$ATTRIBUTES c,alias: '_Print_decomp_message'::Print_decomp_message 

to this:

 !MS$ATTRIBUTES c,alias: 'Print_decomp_message', decorate ::Print_decomp_message 

              --Lorri

View solution in original post

0 Kudos
3 Replies
TimP
Honored Contributor III
719 Views
Apparently, the specification of a leading underscore has broken x64 compatibility. This isn't standard Fortran. The Fortran standard way with iso c binding and no explicit underscore should be compatible with both 32 and 64 bit mode
0 Kudos
Lorri_M_Intel
Employee
720 Views

While using the standard iso_c_binding mechanisms would be *best*, this is the quickest solution to get you going.

change this:

 !MS$ATTRIBUTES c,alias: '_Print_decomp_message'::Print_decomp_message 

to this:

 !MS$ATTRIBUTES c,alias: 'Print_decomp_message', decorate ::Print_decomp_message 

              --Lorri

0 Kudos
Alemdar__Bulent
Beginner
719 Views

Lorri

Thanks a lot. this solution fixed my problem.

Regards

Bulent

 

0 Kudos
Reply