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

error FOR3120: no specific match for reference to generic SETTEXTPOSITION

haizi_cqu
Beginner
1,093 Views
there are two functions named "moveto" and "settextposition", I call them in the main program. However, one is called without error, the "settextposition" is called with error:error FOR3120: no specific match for reference to generic SETTEXTPOSITION.
thedefinitionof function "moveto" is as follows:
$if _MSFORTRAN_ .lt. 300
INTERFACE
SUBROUTINE moveto[ALIAS:"__f_moveto@12"](x,y,s)
INTEGER*2 x,y
STRUCTURE/xycoord/
INTEGER*2 xcoord
INTEGER*2 ycoord
END STRUCTURE
RECORD/xycoord/s[REFERENCE]
END SUBROUTINE
END INTERFACE
$else
INTERFACE MOVETO
SUBROUTINE $$MSFLIB$MOVETO$22[alias:'__f_moveto@12'](x,y,s)
INTEGER*2 x
INTEGER*2 y
STRUCTURE/xycoord/
INTEGER*2 xcoord
INTEGER*2 ycoord
END STRUCTURE
RECORD/xycoord/s[REFERENCE]
END SUBROUTINE
SUBROUTINE $$MSFLIB$MOVETO$24[alias:'__f_moveto@12'](x,y,s)
INTEGER*2 x
INTEGER*4 y
STRUCTURE/xycoord/
INTEGER*2 xcoord
INTEGER*2 ycoord
END STRUCTURE
RECORD/xycoord/s[REFERENCE]
END SUBROUTINE
SUBROUTINE $$MSFLIB$MOVETO$42[alias:'__f_moveto@12'](x,y,s)
INTEGER*4 x
INTEGER*2 y
STRUCTURE/xycoord/
INTEGER*2 xcoord
INTEGER*2 ycoord
END STRUCTURE
RECORD/xycoord/s[REFERENCE]
END SUBROUTINE
SUBROUTINE $$MSFLIB$MOVETO$44[alias:'__f_moveto@12'](x,y,s)
INTEGER*4 x
INTEGER*4 y
STRUCTURE/xycoord/
INTEGER*2 xcoord
INTEGER*2 ycoord
END STRUCTURE
RECORD/xycoord/s[REFERENCE]
END SUBROUTINE
END INTERFACE
$endif
the definition of function" settextposition" is as follows:
$if _MSFORTRAN_ .lt. 300
INTERFACE
SUBROUTINE settextposition &
& [ALIAS:"__fq_settextposition@12"](row,col,s)
INTEGER*2 row
INTEGER*2 col
STRUCTURE/rccoord/
INTEGER*2 rcoord
INTEGER*2 ccoord
END STRUCTURE
RECORD/rccoord/s[REFERENCE]
END SUBROUTINE
END INTERFACE
$else
INTERFACE SETTEXTPOSITION
SUBROUTINE $$MSFLIB$SETTEXTPOSITION$22 &
& [alias:'__fq_settextposition@12'](row,col,s)
INTEGER*2 row
INTEGER*2 col
STRUCTURE/rccoord/
INTEGER*2 rcoord
INTEGER*2 ccoord
END STRUCTURE
RECORD/rccoord/s[REFERENCE]
END SUBROUTINE
SUBROUTINE $$MSFLIB$SETTEXTPOSITION$24 &
& [alias:'__fq_settextposition@12'](row,col,s)
INTEGER*2 row
INTEGER*4 col
STRUCTURE/rccoord/
INTEGER*2 rcoord
INTEGER*2 ccoord
END STRUCTURE
RECORD/rccoord/s[REFERENCE]
END SUBROUTINE
SUBROUTINE $$MSFLIB$SETTEXTPOSITION$42 &
& [alias:'__fq_settextposition@12'](row,col,s)
INTEGER*4 row
INTEGER*2 col
STRUCTURE/rccoord/
INTEGER*2 rcoord
INTEGER*2 ccoord
END STRUCTURE
RECORD/rccoord/s[REFERENCE]
END SUBROUTINE
SUBROUTINE $$MSFLIB$SETTEXTPOSITION$44 &
& [alias:'__fq_settextposition@12'](row,col,s)
INTEGER*4 row
INTEGER*4 col
STRUCTURE/rccoord/
INTEGER*2 rcoord
INTEGER*2 ccoord
END STRUCTURE
RECORD/rccoord/s[REFERENCE]
END SUBROUTINE
END INTERFACE
$endif
In the main program, I call them as follows:
RECORD /xycoord/xy
CALL moveto( 100, 250, xy )
CALL settextposition ( 2, 36, xy)
I want to know why I can call moveto while cannot call settextposition?

thanks.
0 Kudos
1 Solution
mecej4
Honored Contributor III
1,093 Views
You are using a non-standard extension to Fortran-77. Which compiler did you use, and with what options?

The third argument to MOVETO is of type 'xycoord', whereas the third argument to SETTEXTPOSITION is of type 'rccoord'. Even though both these STRUCTURE variables consist of two INTEGER*2 variables, they may not be considered compatible.

A similar situation exists with respect to derived types in Fortran 9x and Fortran 200x.

If there is no need to have STRUCTURE rccoord, replace 'rccoord' by 'xycoord' to allow the source to be compiled without errors.

That said, you really need to use variable types that match whatever types are specified for the library routines that you will link to. Therefore, you need to match the interface bodies to those specified for SETTEXTPOSITION and MOVETO, and the best way for doing that is to use modules. If you follow this recommendation, with CVF 6.x, the only lines of code that you need are

[fortran]      PROGRAM MAIN
USE MSFLIB
RECORD /XYCOORD/xy
RECORD /RCCOORD/rc
...
... assign values to xy, rc, as needed
...
CALL moveto( 100, 250, xy )
CALL settextposition ( 2, 36, rc)
end

[/fortran]

View solution in original post

0 Kudos
7 Replies
John4
Valued Contributor I
1,093 Views

The interface to settextposition might have changed.

The procedures MOVETO and SETTEXTPOSITION are part of QuickWin, so it's better if you use the corresponding module (IFQWIN ) instead of trying to guess how the interface block looks like. Alternatively, take a look at the ifqwin.f90 file (in "%ifort_compiler11%\include" or something similar).

0 Kudos
mecej4
Honored Contributor III
1,094 Views
You are using a non-standard extension to Fortran-77. Which compiler did you use, and with what options?

The third argument to MOVETO is of type 'xycoord', whereas the third argument to SETTEXTPOSITION is of type 'rccoord'. Even though both these STRUCTURE variables consist of two INTEGER*2 variables, they may not be considered compatible.

A similar situation exists with respect to derived types in Fortran 9x and Fortran 200x.

If there is no need to have STRUCTURE rccoord, replace 'rccoord' by 'xycoord' to allow the source to be compiled without errors.

That said, you really need to use variable types that match whatever types are specified for the library routines that you will link to. Therefore, you need to match the interface bodies to those specified for SETTEXTPOSITION and MOVETO, and the best way for doing that is to use modules. If you follow this recommendation, with CVF 6.x, the only lines of code that you need are

[fortran]      PROGRAM MAIN
USE MSFLIB
RECORD /XYCOORD/xy
RECORD /RCCOORD/rc
...
... assign values to xy, rc, as needed
...
CALL moveto( 100, 250, xy )
CALL settextposition ( 2, 36, rc)
end

[/fortran]

0 Kudos
haizi_cqu
Beginner
1,093 Views
Quoting mecej4
The third argument to MOVETO is of type 'xycoord', whereas the third argument to SETTEXTPOSITION is of type 'rccoord'. Even though both these STRUCTURE variables consist of two INTEGER*2 variables, they are not considered equivalent.

A similar situation exists with respect to derived types in Fortran 9x and Fortran 200x.

If there is no need to have STRUCTURE rccoord, replace 'rccoord' by 'xycoord' to allow the source to be compiled without errors.

Although 'rccoord' and 'xycoord' are different names, they are in same structures. So I guess they have same functions. I did replace 'rccoord' to 'xycoord', however, the errors are still there.
How about the difference:
SUBROUTINE settextposition &
& [ALIAS:"__fq_settextposition@12"](row,col,s)
with
SUBROUTINE moveto[ALIAS:"__f_moveto@12"](x,y,s)
0 Kudos
haizi_cqu
Beginner
1,093 Views
I am using Windows Powerstation 4 compiler. I chose this program to be a quickwin project.
0 Kudos
haizi_cqu
Beginner
1,093 Views
Quoting John

The interface to settextposition might have changed.

The procedures MOVETO and SETTEXTPOSITION are part of QuickWin, so it's better if you use the corresponding module (IFQWIN ) instead of trying to guess how the interface block looks like. Alternatively, take a look at the ifqwin.f90 file (in "%ifort_compiler11%\include" or something similar).

I am using Windows Powerstation 4 as the compiler and the project is a quickwin project.
I did include four modules:
INCLUDE 'FGRAPH.FI'
INCLUDE 'ATLDEFS.FOR'
INCLUDE 'ATLERRS.FOR'
..............
INCLUDE' FGRAPH.FD'
I am new of Fortran, would you please explain for me for situation using not Intel Fortran?
Thanks.
0 Kudos
mecej4
Honored Contributor III
1,093 Views
I do not have Powerstation installed any more. I suspect that the code that I gave in #2 might work with it.
0 Kudos
haizi_cqu
Beginner
1,093 Views
Quoting mecej4
I do not have Powerstation installed any more. I suspect that the code that I gave in #2 might work with it.

Assign value to xy and rc?
Call moveto (10,20,xy), I thought xy is assign as 10,20 already , SO I donot need to assign it before?
Thank you for your explanation, I will try that.
Thanks again.
0 Kudos
Reply