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

Problem with /check:uninit (?)

Paul_Curtis
Valued Contributor I
699 Views
I have been experimenting with compiler flags, and find the Fortran runtime /check:uninit produces the following error:

forrtl: severe(193): Run-Time Check Failure. the variable '_MaindWndProc@16$MAINWNDPROC' is being used without being defined

which does not happen when this flag is not used. Win32 programs require extensive use of LOC(ProcFunctionName) as an argument, and this has always worked perfectly. Is there a fundamental incompatability between /check:uninit and this sort of programming, or is this possibly a compiler error?
0 Kudos
5 Replies
Steven_L_Intel1
Employee
699 Views
I've never run into that before - can you show a small sample that demonstrates the problem?
0 Kudos
Paul_Curtis
Valued Contributor I
699 Views
I've never run into that before - can you show a small sample that demonstrates the problem?

Well, here are (all) the instances of MainWndProc, excised from the code. This stuff is totally generic Win32, and has always worked perfectly. The failure of /check:uninit is not really important, since I can reset this flag to the NO position where it has always been, just an interesting curiosity uncovered while exploring whether this flag brings anything useful to the party. BTW, I'm using 11.1.038 in VS2008 on XP.

[cpp]INTEGER FUNCTION WinMain (hInstance, hPrevInstance, lpszCmdLine, nCmdShow)
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_WinMain@16' :: WinMain
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'WinMain' :: WinMain
!DEC$ ENDIF

!... (modules USEd, etc.)
IMPLICIT NONE
SAVE

INTEGER(HANDLE), INTENT(IN) :: hInstance
INTEGER(HANDLE), INTENT(IN) :: hPrevInstance
INTEGER, INTENT(IN) :: lpszCmdLine
INTEGER, INTENT(IN) :: nCmdShow

TYPE(T_WNDCLASS) :: wc
TYPE(T_MSG) :: mesg

!...(other defines etc.)

INTERFACE
INTEGER FUNCTION MainWndProc (hwnd, msg, wParam, lParam)
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_MainWndProc@16' :: MainWndProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'MainWndProc' :: MainWndProc
!DEC$ ENDIF
USE ifwinty
INTEGER(HANDLE), INTENT(IN) :: hwnd
INTEGER(UINT), INTENT(IN) :: msg
INTEGER(fWPARAM), INTENT(IN) :: wParam
INTEGER(fLPARAM), INTENT(IN) :: lParam
END FUNCTION MainWndProc
END INTERFACE
!...

IF (hPrevInstance == 0) THEN
wc%lpszClassName = LOC(lpszClassName)
wc%lpfnWndProc = LOC(MainWndProc)
wc%style = IOR(CS_VREDRAW , CS_HREDRAW)
wc%hInstance = hInstance
wc%hIcon = ghIcon_kiltel
wc%hCursor = LoadCursor( NULL, IDC_ARROW )
wc%hbrBackground = ( COLOR_WINDOW+1 )
wc%lpszMenuName = NULL
wc%cbClsExtra = 0
wc%cbWndExtra = 0
IF (RegisterClass(wc) == 0) THEN
rval = MessageBox (ghwndMain, &
"Error registering main window class."C, &
"Fatal Error"C, MB_OK)
WinMain = 0
RETURN
END IF
END IF

!...(lots of other initializations)

! Read and process messsages until application exit.
DO WHILE (GetMessage (mesg, NULL, 0, 0))
rval = TranslateMessage(mesg)
rval = DispatchMessage(mesg)
END DO
WinMain = mesg%wParam
RETURN
END FUNCTION WinMain



INTEGER FUNCTION MainWndProc (hWnd, msg, wParam, lParam)
!DEC$ IF DEFINED(_X86_)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_MainWndProc@16' :: MainWndProc
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS : 'MainWndProc' :: MainWndProc
!DEC$ ENDIF

IMPLICIT NONE
SAVE
INTEGER(HANDLE), INTENT(IN) :: hwnd
INTEGER(UINT), INTENT(IN) :: msg
INTEGER(fWPARAM), INTENT(IN) :: wParam
INTEGER(fLPARAM), INTENT(IN) :: lParam

SELECT CASE (msg)

CASE (WM_CLOSE)
rval = DestroyWindow (hwnd)
MainWndProc = 0
RETURN

!... many other CASEs

CASE DEFAULT
MainWndProc = DefWindowProc (hWnd, msg, wParam, lParam)
END SELECT

END FUNCTION MainWndProc
[/cpp]

0 Kudos
jimdempseyatthecove
Honored Contributor III
699 Views

>>forrtl: severe(193): Run-Time Check Failure. the variable '_MaindWndProc@16$MAINWNDPROC' is being used without being defined

Error message has _MaindWndProc code sample missing "d"???

Something is amuck (spelling error elsewhere)

Jim


0 Kudos
Paul_Curtis
Valued Contributor I
699 Views

>>forrtl: severe(193): Run-Time Check Failure. the variable '_MaindWndProc@16$MAINWNDPROC' is being used without being defined

Error message has _MaindWndProc code sample missing "d"???

Something is amuck (spelling error elsewhere)

Jim



Sorry, a simple typo because I had to retype the error message which was in a messagewindow which only accepts a mouseclick to end the process, and none of the strings were highlightable. This code has run perfectly for at least 11 years, no problems with typos in the code either.
0 Kudos
Steven_L_Intel1
Employee
699 Views
I've tried a couple of programs that do what yours does and don't see the problem. Can you construct a minimal program that shows it? Just a comment - my preference is to make MainWndProc a CONTAINed routine rather than using an interface block.

Which compiler version are you using?
0 Kudos
Reply