PRB: QuickWin Termination Routines and QuickWin Graphics

Last reviewed: July 18, 1995
Article ID: Q89909
The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, version 5.1

SYMPTOMS

Trying to use the REPLACE.BAT batch file from the Microsoft FORTRAN application note HF0450 "Alternatives to QuickWin Termination Message Box" on a FORTRAN Windows library that has already been configured for use with QuickWin graphics will cause the library utility to generate the following errors:

   LIB : error U2155: qwexit : module not in library; ignored

   LIB : error U2155: qwglob : module not in library; ignored

   LIB : error U2155: qwiswin : module not in library; ignored

LIB will then generate 44 errors similar to the following:

  qwexmode.obj : warning U4151: '__QWINGetExit' : symbol defined in
  module qwkexmod, redefinition ignored

CAUSE

The application note was created before the release of the the QuickWin graphics library. Most of the code in the application note is in the modified QuickWin Windows library, except for an object module, EXITMODE.OBJ, that contains two "wrapper" routines for accessing the routines SETEXITQQ and GETEXITQQ without interface statements. The code is in differently named modules and QWEXIT.OBJ, QWGLOB.OBJ, and QWISWIN.OBJ have already been removed during modification for QuickWin graphics. When the code in the object modules from the application note is added to LLIBFEW.LIB, the symbol redefinition errors occur because the code is already there.

RESOLUTION

Do not run the REPLACE.BAT batch file from the application note. To access the GETEXITQQ and SETEXITQQ routines, there are two options:

  • Add only the object module EXITMODE.OBJ to LLIBFEW.LIB using the command:

          LIB LLIBFEW.LIB +EXITMODE.OBJ;
    

    In this way, the routines can be accessed using no interface statements or by using the interface statements in the FLIB.FI file included with the application note.

    -or-

  • Add two interface statements to the FGRAPH.FI file to use the ALIAS attribute to access the routines that are already in the QuickWin graphics modified LLIBFEW.LIB.

MORE INFORMATION

The actual routines that allow modification of the default exit mode for QuickWin applications are __QWINGetExit() and __QWINSetExit(). The object module EXITMODE.OBJ (included only with the application note) has two wrapper routines (GETEXITQQ and SETEXITQQ) that do nothing but call the __QWIN routines. They are not required if the necessary interface statements are included. For ease of use, some additional information can be added to FGRAPH.FD that allows use of symbolic constants instead of literal constants. NOTE: the two alias contain two consecutive leading underline characters. This may not be apparent in some versions of the text.

Sample Code #1

Put the following interface statements in the FGRAPH.FI file:

      interface to integer*2 function setexitqq
     +                       [c,alias:'__QWINSetExit'](exitmode)

      integer*2 exitmode[value]
      end

      interface to integer*2 function getexitqq
     +                       [c,alias:'__QWINGetExit']()
      end


Sample Code #2

Put the following information in the FGRAPH.FD file:

      INTEGER*2 QWIN$EXITPROMPT
      INTEGER*2 QWIN$EXITNOPERSIST
      INTEGER*2 QWIN$EXITPERSIST

      PARAMETER (QWIN$EXITPROMPT    = 1)
      PARAMETER (QWIN$EXITNOPERSIST = 2)
      PARAMETER (QWIN$EXITPERSIST   = 3)

      INTEGER*2 GETEXITQQ[EXTERN]
      INTEGER*2 SETEXITQQ[EXTERN]


Sample Code #3

The following code illustrates accessing the routines after the above files have been modified:

      include 'fgraph.fi'

      program exitmode

      include 'fgraph.fd'

      integer*2 exmode

      write(*,'(1X,A,/)') 'Please enter the exit mode 1, 2 or 3 '
      read(*,*) exmode

      write(*,'(1X,A,I2)') 'Exit value = ',GETEXITQQ()

      SELECT CASE (exmode)

           CASE (1)
               if( SETEXITQQ( QWIN$EXITPROMPT ) .ne. 0 ) then
                    write(*,*) 'Error returned'
               endif
               write(*,'(1X,A,I2)') 'Exit value = ', GETEXITQQ()

           CASE (2)
               if( SETEXITQQ( QWIN$EXITNOPERSIST ) .ne. 0 ) then
                    write(*,*) 'Error returned'
               endif
               write(*,'(1X,A,I2)') 'Exit value = ', GETEXITQQ()

           CASE (3)
               if( SETEXITQQ( QWIN$EXITPERSIST ) .ne. 0 ) then
                    write(*,*) 'Error returned'
               endif
               write(*,'(1X,A,I2)') 'Exit value = ', GETEXITQQ()

           CASE DEFAULT
               write(*,*) 'Invalid option - checking for bad return'
               if( SETEXITQQ( exmode ) .ne. -1 ) then
                   write(*,*) 'Error not returned'
               else
                   write(*,*) 'Correct error return code'
               endif

      END SELECT

      end


Additional reference words: 5.10
KBCategory: kbprg kberrmsg kbcode kbprb
KBSubategory: FORTLngIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 18, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.