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

Strange error message under VS2010 - function reference does not mathc function definition

Arjen_Markus
Honored Contributor II
771 Views

Hello,

I have a rather curious problem running Intel Fortran 12.1 under VS2010. My code looks essentially like this:

program xx
    implicit none

    logical, external :: modelinitialize

    logical           :: success

    success = ModelInitialize()
end program xx

When I compile the actual source under VS2010 (as part of a much larger project/solution), I get the error message:

error #7977: The type of the function reference does not match the type of the function definition.   [MODELINITIALIZE]
        success = ModelInitialize()
^

(as the routine needs to be callable from Java, it is not contained in a module)

If I compile the source outside of VS2010 with the same compile options, this problem does not occur. None of my colleagues working on the same project see this problem. Even creating a new project with just this file does not give any compil problem.

What can be the matter?

0 Kudos
6 Replies
mecej4
Honored Contributor III
771 Views
The names differ as to case (upper/lower/combination). Do you have directives that affect the case of external symbols? Perhaps to make the function work with Java, which is a language that honors case?
0 Kudos
Arjen_Markus
Honored Contributor II
771 Views
No, just the standard ones - nothing that I can think of. Besides if case sensitivity were enabled, then wouldn't the two occurrences be seen as two entirely different routines/functions?
0 Kudos
Anthony_Richards
New Contributor I
771 Views
Shouldn't you show us where ModelInitialize is defined so we can see what the compiler is expecting its interface to be?
0 Kudos
Arjen_Markus
Honored Contributor II
771 Views
Well, that is in the top part of the file: logical, external :: ModelInitialize It is a more modern version of the FORTRAN 77 way of dealing with external functions (modern, because of the combination into one statement)
0 Kudos
Steven_L_Intel1
Employee
771 Views
In Visual Studio you get generated interface checking. The compiler is then noticing that the actual function is declared as returning a type other than LOGICAL. You need to show us the called routine.
0 Kudos
Arjen_Markus
Honored Contributor II
771 Views
Steve, you are absolutely right! The source file containing the function ModelInitialize defines it as an integer function (because of the Java connection). Stupid blind spot - I had all but forgotten these automatically generated interfaces. Well, easy to fix. Thanks very much, Arjen
0 Kudos
Reply