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

KERNEL32.f90 changes 18.0.1 -> 18.0.2

Julian_H_
Beginner
308 Views

Hey,

we use the function WriteFile from the MSFWIN module. Unfortunately we had some issues after updating von 18.0.1 auf 18.0.2.. We found out that the interface was changed so that lpNumberOfBytesWritten now is not exspecting anymore LOC(anyInt), instead you just need to pass the integer because of a change in the compiler settings. Was this change intended? I did not find anything in the changelog https://software.intel.com/sites/default/files/managed/20/a2/IPSXE_2018_Update2_Release_Notes_EN.pdf.

 

18.0.1 kernel32.f90:

INTERFACE 
FUNCTION WriteFile( &
        hFile, &
        lpBuffer, &
        nNumberOfBytesToWrite, &
        lpNumberOfBytesWritten, &
        lpOverlapped)
import
  integer(BOOL) :: WriteFile ! BOOL
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WriteFile' :: WriteFile
  integer(HANDLE) hFile ! HANDLE hFile
  integer(LPCVOID) lpBuffer ! LPCVOID lpBuffer
  integer(DWORD) nNumberOfBytesToWrite ! DWORD nNumberOfBytesToWrite
  integer(DWORD) lpNumberOfBytesWritten ! LPDWORD lpNumberOfBytesWritten
!DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: lpOverlapped
  TYPE (T_OVERLAPPED) lpOverlapped ! LPOVERLAPPED lpOverlapped
 END FUNCTION
END INTERFACE

 

18.0.2 kernel32.f90:

INTERFACE 
FUNCTION WriteFile( &
        hFile, &
        lpBuffer, &
        nNumberOfBytesToWrite, &
        lpNumberOfBytesWritten, &
        lpOverlapped)
import
  integer(BOOL) :: WriteFile ! BOOL
    !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'WriteFile' :: WriteFile
  integer(HANDLE) hFile ! HANDLE hFile
  integer(LPCVOID) lpBuffer ! LPCVOID lpBuffer
  integer(DWORD) nNumberOfBytesToWrite ! DWORD nNumberOfBytesToWrite
  integer(DWORD) lpNumberOfBytesWritten ! LPDWORD lpNumberOfBytesWritten
!DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: lpNumberOfBytesWritten
  TYPE (T_OVERLAPPED) lpOverlapped ! LPOVERLAPPED lpOverlapped
!DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC, ALLOW_NULL :: lpOverlapped
 END FUNCTION
END INTERFACE

 

0 Kudos
1 Reply
Steve_Lionel
Honored Contributor III
308 Views

Yes, the interface changed because the old one was wrong. On a 64-bit platform, it would have you pass a 32-bit integer by value when what was wanted was the address of a 32-bit integer. The addition of IGNORE_LOC and ALLOW_NULL allows for compatibility of old code that used LOC(arg).

You haven't shown us what problem this change caused.

0 Kudos
Reply