I was trying (unsuccessfully) to find fortran definitions of windows variables (e.g. WPARAM, LPARAM, HWND, etc.) and system functions interface in the intel documentation or include files.
Where is it possible to locate such matter ?
Look in the compiler's INCLUDE directory. Instead of the large number of defined types (from C typedefs) that are simply different names for integers of various sizes, the Fortran declarations simply use INTEGER(<the relevant size>) :: <variable>. For instance, you find in user32.f90
integer(HANDLE) hwnd ! HWND hwnd
However, looking for example at the Post Message function one finds:
FUNCTION PostMessage( &
integer(BOOL) :: PostMessage ! BOOL
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'PostMessageA' :: PostMessage
integer(HANDLE) hWnd ! HWND hWnd
integer(UINT) Msg ! UINT Msg
integer(UINT_PTR) wParam ! WPARAM wParam
integer(LONG_PTR) lParam ! LPARAM lParam
but LONG_PTR is not defined in the index of the compiler documentation and I need to find its definition in terms of the intrinsic fortran data types. ... but I can find its definition in another file IFWINTY.F90, and so on ...
What I would like to point out is that this matter should be well documented by Intel. A user of the IVF compiler "FOR WINDOWS" should not rely on the kindness of the members of this forum.
The definitions you seek are in module IFWINTY - the source is also in the compiler include directory. Most of the Windows types are defined with the same spelling, but some have variants due to conflicts with Fortran keywords (INT for example). Most derived types have _T suffixes. This module is USEd by the other Windows API modules such as KERNEL32, so you rarely have to invoke it directly.
As noted, for things such as WPARAM and LPARAM, you need to use INTEGER(WPARAM), etc., as Fortran doesn’t (yet) have type aliases (typedefs in C).
Robert van Amerongen wrote:
take a look at
where you will find additional information on data type. Hopes it helps you.
I know the document quite well: developing from many years all windows interfaces, to run Fortran simulation engines, in C++ with MS Visual Studio.
What I would expect to find, in the body of Intel Fortran documentation, is a similar/parallel document listing the corresponding Fortran types.
As I noted, they’re all in the source for module IFWINTY. If the documentation had a list, it would be enormous and out of date immediately.
That said, you should also look at https://software.intel.com/en-us/compiler_winapp_f
My opinion. I use the windows API all the time. It would be a huge task and a bit pointless for Intel to document them for Fortran. The reference is at MSDN, you then need to look at IFWIN.f90 (and it's sub-sets) to see how ta particular API has been implemented in Fortran as there can be more than one way. Finding things in the fortran includes is fast using the VS search tools. This seems just fine by me and IMO If this is too complicated for a user then maybe they probably aren't going to be able to program in the Windows API's anway.....
to the end the discussion is not related to expertise in using windows API but about the quality of the documentation produced by Intel accompanying its Fortran compiler. My opinion is that its quality is very far from sufficiency.
In reference to Quote #4, Intel gives most derived type T_ prefixes; _t suffixes is the C language way. When I wrote a bunch of Windows stuff in gfortran I was using the suffix formulation and of course later had to change it all to prefixes to be consistent with ifort usage :(