<<< VAXAXP::NOTES$:[NOTES$LIBRARY]VMSNOTES.NOTE;1 >>> -< VAX and Alpha VMS - Digital Internal Use Only >- ================================================================================ Note 1787.6 LIB$FIND_IMAGE_SYMBOL ACCVIO/HANG w V7.0 & non-share 6 of 6 CSC32::D_SANFORD 170 lines 6-NOV-1996 13:12 -< LIB$SIG_TO_RET appears to work... >- -------------------------------------------------------------------------------- Below I've include a modified MACRO routine which uses LIB$SIG_TO_RET. It works, but it is difficult to determine what happened... An ACCVIO (12) will be returned to your BASIC routine for V7.x and sucess (3) for V6.2. Also, see the article below which basically says not to use LIB$SIG_TO_RET with LIB$FIND_IMAGE_SYMBOL. Possibly this was fixed in VMS V5.5-2 and later. -drew $ ! $ ! Non-shareable image for LIB$FIND_IMAGE_SYMBOL $ CREATE TEST_NOSHR.BAS PRINT "non-shareable image" END $ ! $ ! Main to call macro routine which invokes LIB$FIND_IMAGE_SYMBOL $ CREATE TEST_LIB.BAS 1 EXTERNAL LONG FUNCTION TEST_INV( STRING, STRING ) DECLARE LONG L_ERR 10 L_ERR = TEST_INV( "CALLED_FUNC", "TEST_INVOKED$MAIN" ) IF ( L_ERR AND 1% ) = 0% THEN PRINT "Condition Code : ";L_ERR END IF END $ ! $ ! Routine to establish condition hander and call LIB$FIND_IMAGE_SYMBOL $ CREATE TEST_INV.MAR .TITLE TEST_INV Dynamically activate a shareable image .LIBRARY "SYS$LIBRARY:LIB.MLB" .PSECT PURECODE,CON,EXE,GBL,NOWRT,PIC,RD,REL,SHR,USR,LONG .CALL_ENTRY MAX_ARGS=15,HOME_ARGS=TRUE,LABEL=TEST_INV ; ; don't establish condition handler and you'll get an ACCVIO; otherwise ; it will hang in the call to LIB$FIND_IMAGE_SYMBOL ; MOVAB G^LIB$SIG_TO_RET,0(FP) ; Establish condition handler PUSHAL ROUTINE_ADDR ; Holder for routine address PUSHL 8(AP) ; Pass address symbol to find PUSHL 4(AP) ; & Address of logical name descr. CALLS #3,G^LIB$FIND_IMAGE_SYMBOL BLBS R0,6$ ; BRW ERROR ; Set error flag and return 6$: CLRL 0(FP) ; Clear condition handler 100$: CALLS #0,@ROUTINE_ADDR CLRL R0 ; Clear error flag ERROR: RET ; Return .PSECT LOCALDATA,CON,NOEXE,LCL,WRT,PIC,RD,REL,NOSHR,LONG ROUTINE_ADDR: .LONG 0 ; Routine address .END $ ! $ ! Test using a simple Fortran example $ CREATE TEST_LIB2.FOR INTEGER*4 STAT, SYMBOL, LIB$FIND_IMAGE_SYMBOL STAT = lib$find_image_symbol ( 'CALLED_FUNC', 1 'TEST_INVOKED$MAIN', SYMBOL) IF (.not. STAT) CALL LIB$STOP(%VAL(STAT)) END $ ! $ ! Compile sources $ BASIC/NOOPT/DEBUG TEST_NOSHR $ BASIC/NOOPT/DEBUG TEST_LIB $ MACRO/DEBUG TEST_INV $ FORTRAN/NOOPT/DEBUG TEST_LIB2 $ ! $ ! Link $ LINK TEST_NOSHR $ LINK/DEBUG TEST_LIB,TEST_INV $ LINK/DEBUG TEST_LIB2 $ ! $ ! Run $ WRITE SYS$OUTPUT "Running TEST_LIB2...(application will ACCVIO)" $ file = f$parse("TEST_NOSHR.EXE") $ DEFINE/USER SYS$INPUT SYS$COMMAND $ DEFINE/USER CALLED_FUNC 'file $ RUN TEST_LIB2 $ ! $ WRITE SYS$OUTPUT "Running TEST_LIB...(application will hang)" $ DEFINE/USER SYS$INPUT SYS$COMMAND $ DEFINE/USER CALLED_FUNC 'file $ RUN TEST_LIB [OpenVMS] Inconsistent Behavior From LIB$FIND_IMAGE_SYMBOL With LIB$SIG_TO_RET Any party granted access to the following copyrighted information (protected under Federal Copyright Laws), pursuant to a duly executed Digital Service Agreement may, under the terms of such agreement copy all or selected portions of this information for internal use and distribution only. No other copying or distribution for any other purpose is authorized. Copyright (c) Digital Equipment Corporation 1992, 1994. All rights reserved OP/SYS: VAX VMS Version 4.7 OpenVMS VAX Versions 5.0, 5.0-1, 5.0-2, 5.1, 5.1-B, 5.1-1, 5.1-2, 5.2, 5.2-1, 5.3, 5.3-1, 5.3-2, 5.4, 5.4-1, 5.4-2, 5.4-3, 5.5, 5.5-1 COMPONENT: Run-Time Library SOURCE: Digital Equipment Corporation SYMPTOM: Successive calls to LIB$FIND_IMAGE_SYMBOL produce different results when called with LIB$SIG_TO_RET as a condition handler. The first call fails, but the second is successful. For example, LIB$FIND_IMAGE_SYMBOL is called to lookup a symbol in a shareable image. One of the modules linked in this image had generated a warning message when it was compiled. On the first call to LIB$FIND_IMAGE_SYMBOL, with LIB$SIG_TO_RET as a condition handler, the call terminates with the following error: %LIB-W-EOMWARN, compilation warnings in module MY_SHARE On a subsequent LIB$FIND_IMAGE_SYMBOL call for the same shareable image, with LIB$SIG_TO_RET as a condition handler, the call completes successfully and the symbol value is returned. DIGITAL RESPONSE: It is unlikely this problem will be addressed in a future release due to its low priority. In addition, there have been very few reported occurrences. However, if this is a high impact problem for your system, please contact Digital support. ANALYSIS: This behavior occurs because the condition handler LIB$SIG_TO_RET unwinds the stack, rather than allowing LIB$FIND_IMAGE_SYMBOL to complete execution, after the error has has been signaled. When LIB$FIND_IMAGE_SYMBOL is called to load an image for the first time, a number of checks are performed on it. If a condition is found, such as a compilation warning in on of the modules in the image, an appropriate message is signaled. These checks aren't performed on subsequent calls to find symbols in that same image. Note that after such a message is signaled, that execution of LIB$FIND_IMAGE_SYMBOL continues, if appropriate. Note that this is dependent on the condition handler returning, rather than unwinding the stack. If LIB$SIG_TO_RET is used as a condition handler, the stack is unwound and LIB$FIND_IMAGE_SIGNAL doesn't get a chance to complete. WORKAROUND: Do not use LIB$SIG_TO_RET as a condition handler when calling LIB$FIND_IMAGE_SYMBOL. Instead, use a condition handler that exits with SS$_CONTINUE when its processing has completed.