PRB: Run-time Subroutines Do Not Appear to FunctionLast reviewed: March 11, 1997Article ID: Q125469 |
1.00a | 1.00 4.00
MSDOS | WINDOWS NT
kbprg kbprb
The information in this article applies to:
SYMPTOMSThe code compiles, links, and runs with no errors, but some of the run-time subroutines do not appear to function correctly. Unexpected results are returned.
CAUSEThe subroutine may not have an interface statement or a parameter used in the subroutine may not be defined.
RESOLUTIONInclude FLIB.FI prior to the PROGRAM statement or as the first line in any file that uses these subroutines or functions. Also, include FLIB.FD inside the main program or any subroutine or function that uses the run- time subroutines.
MORE INFORMATIONThe following code sample compiles, links, and runs without generating an error, but the array is not sorted and the random seed is initialized with a zero. In the case of the SORTQQ routine, the last argument is a parameter defined in FLIB.FD. Because that file is not included, the variable is typed as a REAL and initialized to zero. SORTQQ fails to sort because the size of the data items to be sorted is zero. If the file FLIB.FI is included by changing the first INCLUDE from a comment into an executed line, you will receive these errors:
F4016 : SEED : formal argument ARG: type mismatch F4016 : SORTQQ : formal argument SIZE: type mismatchIf the variables passed to these routines are type compatible and indicate correct values, the program may run correctly. To solve the problem in the sample below, change both include lines from comments into executable lines. Additionally, there may be several run-time subroutines that use parameters defined in the FLIB.FD file, but the documentation fails to indicate that you must include FLIB.FD. The following is a partial list of those subroutines:
ELLIPSE, ELLIPSE_W GETWRITEMODE PIE, PIE_W REMAPALLPALETTE, REMAPPALETE SEED SETWRITEMODE Sample CodeC Compile options needed: none C INCLUDE 'flib.fi' PROGRAM TestC INCLUDE 'flib.fd'
INTEGER maxsize INTEGER*4 buf(100) INTEGER*4 i REAL*4 rdm PRINT*, "Enter the number of values (max = 100): " READ(*, "(I4)") maxsize IF(maxsize .GT. 100 ) maxsize = 100 CALL SEED(RND$TIMESEED) DO i = 1, maxsize CALL RANDOM(rdm) C Random value from 1 to maxsize buf(i) = INT4(rdm * maxsize + 1.0) END DOC Print out the unsorted array WRITE(*, "(5I6)") (buf(i), i = 1, maxsize) PRINT*C Sort the array CALL SORTQQ(LOC(buf), maxsize, SRT$INTEGER4)C Print out the sorted array WRITE(*, "(5I6)") (buf(i), i = 1, maxsize) PRINT* END |
Additional reference words: 1.00 1.00a 4.00 fail bomb incorrect bad runtime
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |