- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using the free Visual Studio 2013 with my Intel 2016 Fortran Compiler and I get the error #6683. Here is a code segment (just a part of my code) that demonstrates the errors:
interface
integer*4 function CreateWindowEx (dwExStyle,lpClassName,lpWindowName,dwStyle, &
x, y, nWidth, nHeight, hWndParent, hMenu, &
hInstance, lpParam )
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'CreateWindowEx' :: CreateWindowEx
use IFWIN
Integer(DWORD),intent(in):: dwExStyle
Integer(LPCTSTR),intent(in):: lpClassName
. . . more after this
error #6683: A kind type parameter must be a compile-time constant. [LPCTSTR]
Integer(LPCTSTR),intent(in):: lpClassName
------------^
If I declare the function to return a HWND then it gets an error too.
Brooks V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ouch, that interface body hurts my eyes! If you are going to USE IFWIN, just go with the explicit interface for CreateWindowEx that IFWIN already provides through user32. integer*4 is wrong, as it should be integer(HANDLE). The alias should be CreateWindowExA. ifort doesn't provide separate parameters like HWND because some of the Win32 API functions have dummy arguments with names like hWnd distinguishable only by case in C, so it would be complicated if HWND was a named constant in Fortran. Just use HANDLE for all those things except for HFILE. I suggest you look at user32.f90 in Intel's include directory for a tutorial on how to write those interface bodies.
Edit: I didn't see mecej4's reply. IFWIN already uses IFWINTY; if you USE IFWIN, you are pretty much using everything.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Many of the Windows type objects such as LPCSTR, etc., are not standard Fortran (sometimes not even standard C) intrinsic types, so you have to USE a module such as winty or include a declarations .h or .inc file that supplies definitions for them, or roll your own type declarations that match those used by Microsoft C.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ouch, that interface body hurts my eyes! If you are going to USE IFWIN, just go with the explicit interface for CreateWindowEx that IFWIN already provides through user32. integer*4 is wrong, as it should be integer(HANDLE). The alias should be CreateWindowExA. ifort doesn't provide separate parameters like HWND because some of the Win32 API functions have dummy arguments with names like hWnd distinguishable only by case in C, so it would be complicated if HWND was a named constant in Fortran. Just use HANDLE for all those things except for HFILE. I suggest you look at user32.f90 in Intel's include directory for a tutorial on how to write those interface bodies.
Edit: I didn't see mecej4's reply. IFWIN already uses IFWINTY; if you USE IFWIN, you are pretty much using everything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
IFWIN defines LPCSTR but not LPCTSTR. Nevertheless, go with Repeat Offender's recommendation and use the CreateWindowEx declaration we provide that allows for CHARACTER arguments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK! But what is a good reference for which use programs define which labels?
Brooks V
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, the best reference is the topic "Using the Windows API Routines" in the Compiler Reference. https://software.intel.com/en-us/compiler_winapp_f is also useful. But these don't go into quite that level of detail. It often helps to open ifwinty.f90 (in the compiler's Include folder) in a text editor, and for function declarations, the appropriate module source such as user32.f90 to study the interface shown.
I'd also recommend looking through the various samples provided, especially the ones in Win32.zip.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I want to check the Fortran declarations then using CreateWindowEx as and example:
1) Look at the MSDN referance page e.g. https://msdn.microsoft.com/en-gb/library/windows/desktop/ms632680%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
2) In the table at the end of the article you will see this API is in the USER32 library
3) Goto C:\Program Files (x86)\Intel\Composer XE 2015\compiler\include (or whatever your version is) and Open USER32.f90.
4) Find the CreateWindowEx entry and in the interface you will see the inferdface types used by IFORT,.
Simples
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks all. Consider this closed.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page