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

Fortran Pre-procesor Query & Feature request

dannycat
New Contributor I
596 Views

I need to be able to call the SetClassLongPtr but there is currently no interface for this in the supplied windows modules. I created one myself based upon the definition for SetWindowWord in user32.f90 and it works fine as echoed below.

INTERFACE
FUNCTION SetClassLongPtr( hWnd, nIndex, dwNewLong)
use ifwinty
integer(LONG_PTR) :: SetClassLongPtr ! LONG_PTR
!DEC$ IF DEFINED(_M_IA64) .OR. DEFINED(_M_AMD64) .OR. DEFINED(__x86_64__)
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'SetClassLongPtrA' :: SetClassLongPtr
!DEC$ ELSE
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'SetClassLongA' :: SetClassLongPtr
!DEC$ ENDIF
integer(HANDLE) hWnd ! HWND hWnd
integer(SINT) nIndex ! int nIndex
integer(LONG_PTR) dwNewLong ! LONG dwNewLong
END FUNCTION
END INTERFACE

However in one project I had the somehow set the preprocessor properties option to Yes (/fpp) instead of No and then the compiler started to complain  that the preprocssor statement was getting an integer value instead of the expected charactor type. Is this expected behavior as the documentation is not  very explicit?

Feature request:  Could SetWindowLongPtr interface be added to the official user32.f90?

Thanks

Steve

0 Kudos
7 Replies
JVanB
Valued Contributor II
597 Views

It's a shame that !DEC$ ALIAS seems to require a <i>character-literal</i> rather than a <i>character-initialization-expression</i> which would permit the user to do away with the !DEC$ IF DEFINED stuff that seems to be causing the problems in the first place.

0 Kudos
Steven_L_Intel1
Employee
597 Views

I will see what I can do about getting the interface added.

Please provide more details on the preprocessor issue. If you'd attach a zip of a test case and sample output that would be helpful.

RO, I don't think that would be helpful here.

0 Kudos
JVanB
Valued Contributor II
597 Views

[fortran]INTERFACE
   FUNCTION SetClassLongPtr( hWnd, nIndex, dwNewLong)
      use ifwinty
      implicit none
      integer(LONG_PTR) :: SetClassLongPtr ! LONG_PTR
      integer, parameter :: nbits = bit_size(0_HANDLE)
! No preprocessor used so there should be no preprocessor errors.
      character(*), parameter :: WinFunName = 'SetClassLong'//trim(merge('PtrA','A   ',nbits==64))
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS: WinFunName :: SetClassLongPtr
      integer(HANDLE) hWnd ! HWND hWnd
      integer(SINT) nIndex ! int nIndex
      integer(LONG_PTR) dwNewLong ! LONG dwNewLong
   END FUNCTION
END INTERFACE[/fortran]

0 Kudos
dannycat
New Contributor I
597 Views

Steve,

The corresponding GetClassLong/GetClassLongPtr function is not defined in user32.f90 either so if you are able to get the SetClassLongPtr interface introduced perhaps it makes sense to add both together.

Thanks 

0 Kudos
Steven_L_Intel1
Employee
597 Views

Yes, I intend to look at all of these.  There are lots and lots of new API routines we are missing. Adding these is not trivial but we're doing what we can.

0 Kudos
dannycat
New Contributor I
597 Views

Thanks Steve, I understand that any mods require a lot of testing and validation work. 

0 Kudos
Steven_L_Intel1
Employee
597 Views

The testing and validation is work, to be sure, but discovering which APIs are new or changed, and building the Fortran equivalents, that's the most time-consuming. We've tried automated tools but they only get us so far.

0 Kudos
Reply