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

unresolved external symbol

Es_En
Beginner
495 Views
I have a huge code written in Fortran 77, and I am trying to build it with both Fortran 77 or 95 compilers. However, It complains that:
Error 1 unresolved external symbol _RUNRCGN@120 referenced in function _CALMATSCAT@68 ctscan.obj
I have already had same problems with this code, but whenever I was adding the unresolved subroutines to the source files, it would be resolved. However,this time it does not work either when I am leaving the subroutine "RUNRCGN" and its associated subroutines in the main program or separate files among source files. The RUNRCGN and all its associated subroutines and functions are available. I am wondering if there is someone with any idea to know how to deal with it. Thanks so much.
0 Kudos
3 Replies
DavidWhite
Valued Contributor II
495 Views
It is possible that you have a mismatch of arguments. The @120 refers to the total size of the arguments passed to the function. It is possible that your function definition has e.g. @116 if there was one less real argument. Any correctcalls to the function would not be flagged.

You could turn argument checking on to see if the compiler detects where the error is.

David
0 Kudos
Jugoslav_Dujic
Valued Contributor II
495 Views
To be more precise, in STDCALL convention, @120 refers to number of bytes pushed to the stack; since every Fortran argument is basically a reference (4 bytes on Win32), @120 means that you give it 120/4 = 30 arguments total, but the declared routine expects a different number.

Note, however, that a CHARACTER(*) argument requires "@8" bytes -- 4 for the address and 4 for the length. A common trick in the past was to "mix" e.g. CHARACTER and BYTE (or even INTEGER or REAL) actual and dummy arguments. Under most compilers, you could get away with that, but not under CVF (or IVF with /iface: CVF switch).

It's best if you could fix the mismatch. If it was an intentional type-cheating not easy to resolve, you could compile with options which would able to [try to] get away with that. On IVF, remove /iface:CVF. On CVF, use... I forgot. It's spelled "C, by reference" in Fortran/External routines/Argument passing convention.
0 Kudos
Es_En
Beginner
495 Views
Thanks guys. The comments you made were awesome and helped me to resolved the problem.
0 Kudos
Reply