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

Definition Change in CVF vs. IVF

marshallc
Beginner
502 Views
I'm migrating my application from Compaq Visual Fortran to Intel Visual Fortran and have run into a bump. Does anyone know if the definitions for MoveWindow and SendMessage have changed? I'm getting warnings that the data type of the actual argument does not match the definition. I think this is causing my statusbar to not display at the bottom. It was working in Compaq Visual Fortran, but it is not working in Intel Visual Fortran. Any help would be greatly appreciated. By the way, does anyone know if there is any type of documentation for Intel Visual Fortran (ie, command reference manual)? The documentation that was installed with the program does not provide enough info. Thanks!
0 Kudos
10 Replies
Paul_Curtis
Valued Contributor I
502 Views
Many of the Win32 API F90 interfaces are quite a bit different between CVF and IVF. The initial versions of IVF were mostly identical with CVF, but theIVF upgrade fromversion 8 to 9 brought many changes (totally undocumented), mostly aimed at tightening compliance with standard Win32 usage (ie, for thegood). Also, IVF no longer permits CALLing functions -- they must be equated to an integer return value.
The best way to address this sort ofproblem is to track down the actual IVF interface code, located in the various Win32 include modules (eg, USER32.F90, and so forth) and modify your code to provide the correct functional form and arguments.
That being said, I do not recall any changes to SendMessage, which is an integerfunction (not a subroutine) with 4 integer arguments.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
502 Views
Also, IVF9 is far more picky about LOGICAL/INTEGER mismatches than earlier versions. I have a hunch that was the cause of OP's problem, i.e. that he has a .TRUE. instead of 1 or TRUE in the call.

I also welcome that pickiness, but it came a bit too late; sometimes deliberately, sometimes not, I used that INTEGER/LOGICAL feature frequently, and CVF didn't even bother to issue a warning.

Jugoslav
0 Kudos
marshallc
Beginner
502 Views
From a newbie standpoint, how do I do this:
"The best way to address this sort ofproblem is to track down the actual IVF interface code, located in the various Win32 include modules (eg, USER32.F90, and so forth) and modify your code to provide the correct functional form and arguments."
I've always read or heard developers talk about tracking down the modules, but I never heard how it is done.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
502 Views
Simply:

- Find in Files
- C:Program FilesIntelCompilerFortran9.0IA32Include*.f90

and take a look into definition (parameter value/type declaration/interface block).

Jugoslav
0 Kudos
marshallc
Beginner
502 Views
Thanks for the info! This helps me figure out why I'm getting the warning messages.
0 Kudos
Steven_L_Intel1
Employee
502 Views
The interface for SendMessage has not changed since CVF. However, the compiler is now stricter about type mismatches, and this IS documented in the Release Notes. For example, if you pass a 0 to an argument which is an INTEGER(1), the compiler will now complain. See the Release Notes for more on this.
0 Kudos
marshallc
Beginner
502 Views
OK... I found something that doesn't make any sense. I went into the User32.F90 and found MoveWindow. Here is what it shows:
Code:
INTERFACE 
FUNCTION MoveWindow( &
        hWnd, &
        X, &
        Y, &
        nWidth, &
        nHeight, &
        bRepaint)
use ifwinty
  integer(BOOL) :: MoveWindow ! BOOL
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'MoveWindow' :: MoveWindow
  integer(HANDLE) hWnd ! HWND hWnd
  integer(SINT) X ! int X
  integer(SINT) Y ! int Y
  integer(SINT) nWidth ! int nWidth
  integer(SINT) nHeight ! int nHeight
  integer(BOOL) bRepaint ! BOOL bRepaint
 END FUNCTION
END INTERFACE

Here is a piece of my code showing the variable being declared and the statement in which it is being used:
Code:
logical :: redraw = .TRUE.

iret = MoveWindow(ihWndStatus ,0,cyClient-iSBheight,&
       cxClient,cyClient,redraw)

When I compile the code, I get the following warning:

Warning: The data type of the actual argument does not match the definition. [REDRAW]

If the definition of the MoveWindow function (?) states that the last variable needs to be boolean/logical, and I've declared it this way in my code. Why is the compiler telling me that the data type does not match? Am I missing something?

0 Kudos
Steven_L_Intel1
Employee
502 Views
Boolean is not logical - not in Fortran. Note that the argument is "integer(BOOL)", not "logical". Logical and integer types are not the same, though as an extension we do free converts between them.

What you want is your redraw variable to be declared integer(BOOL) and assign the value TRUE (not .TRUE.) to it. TRUE is a constant defined in ifwinty (which you get indirectly with user32.)
0 Kudos
marshallc
Beginner
502 Views

Thanks, Steve. The warning is gone, but I guess that wasn't the cause for the statusbar not to appear. Something else must have happened during the conversion.

By the way, where can I find more information on integer(BOOL) or integer(SINT)? I have looked in the FORTRAN library and language reference, but there are no hits when I do a search. Now that I have a way of checking on what the function is actually defined as, I want to make sure the variables are set correctly... example... is integer(SINT) the same as integer(2)?

0 Kudos
Steven_L_Intel1
Employee
502 Views
Read the source of ifwinty.f90. The intent is to use the same type names as MS uses in the Win32 documentation. You should NEVER use LOGICAL in Win32 APIs. Most everything is integer, real or character. There are kinds defined for the various pointer kinds Win32 defines. I recommend against using explicit kind numbers such as 2 or 4 in your code - use the PARAMETER constants defined by ifwinty.
0 Kudos
Reply