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

CVF to IVF

ahasan
Beginner
636 Views
After completeing the conversion of a CVF program to IVF8.1, I get a large number of the same warning messages upon building the solution.
"Warning: the data type of the actual argument does not match the definition"
These Warningsall seem to be associated with calls to WIN32 APIs where I insert .TRUE. or .FALSE. in the argument list. For example:
iret = EnableWindow(hWnd, .TRUE.)
the interface statement in USER32.f90 for EnableWindow(hWnd, bEnable)
defines bEnable as integer(BOOL), and BOOL is defined in IFWINTY as 4.
Do I have to change all logical constants in my program from .TRUE. to .TRUE_4, or am I barking up the wrong tree?
Thanks for any info.

Message Edited by halcyong@fcc.net on 11-17-2005 09:05 AM

0 Kudos
4 Replies
Steven_L_Intel1
Employee
636 Views
You have made the mistake of thinking that bool is the same as Fortran LOGICAL. It is not. the Win32 API is looking for C-style bool, which has specific semantics that are different from Fortran LOGICAL. It is incorrect to pass .TRUE. and .FALSE. to a Win32 API that expects BOOL. CVF had a bug where it did not diagnose this mismatch when an explicit interface was provided.

Use the defined constants TRUE and FALSE (no dots) and declare any variables you want to be bool-equivalent as INTEGER(BOOL). If you have other LOGICAL values in your program, as long as you are not using them in bool contexts, then they can be left alone.
0 Kudos
ahasan
Beginner
636 Views
Still a little confused:
USER32.f90 defines an interface for EnableWindow() as follows:
INTERFACE
FUNCTION EnableWindow( &
hWnd, &
bEnable)
use ifwinty
integer(BOOL) :: EnableWindow ! BOOL
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'EnableWindow' :: EnableWindow
integer(HANDLE) hWnd ! HWND hWnd
integer(BOOL) bEnable ! BOOL bEnable
END FUNCTION
END INTERFACE
and ifwinty.f90 defines BOOL as:
integer, parameter :: BOOL = 4
so if I want to call the WIN32 function EnableWindow() I should do the following:
integr(4) hWnd
integer(BOOL) True ! which is integer(4)
integer(BOOL) False
...
True = 1
False = 0
iret = EnableWindow(hWnd, True) ! to ungray window
iret = EnableWindow(hWnd, False) ! to gray out window
Does this have anything to do withpassing Logical expressions to non Fortran proceduresas discussed in the 'Intel Fortran Language Reference' specifically Table 8-1 and the functions %VAL and %REF and foot note 1?
Thanks again for a reply.

Message Edited by halcyong@fcc.net on 11-17-2005 04:43 PM

0 Kudos
Steven_L_Intel1
Employee
636 Views
IFWINTY already defines TRUE and FALSE with the correct values. You do not need to declare these yourself.
0 Kudos
ahasan
Beginner
636 Views
Steve, thanks for the very quick reply and the info. I understand!
0 Kudos
Reply