From: SMTP%"westfall@TeleCheck.com" 28-OCT-1994 16:23:40.47 To: EVERHART CC: Subj: lib$find_image_symbol on OpenVMS AXP V1.5 From: westfall@TeleCheck.com (Roy Westfall) X-Newsgroups: comp.os.vms Subject: lib$find_image_symbol on OpenVMS AXP V1.5 Date: 28 Oct 1994 19:21:59 GMT Organization: The Black Box, Houston, Tx (713) 480-2686 Lines: 117 Message-Id: <38rj0n$h2i@news.blkbox.com> Nntp-Posting-Host: telecheck.com X-Newsreader: TIN [version 1.2 PL2] To: Info-VAX@Mvb.Saic.Com X-Gateway-Source-Info: USENET A couple of weeks ago I posted a message about a problem I was having with LIB$FIND_IMAGE_SYMBOL on an alpha. I have discovered the source of the problem and it goes something like this. IF you have a shareable image linked against the DEC CXX rtl and you use lib$find_image_symbol to load that image from an image that is NOT linked against DEC CXX, the load causes some memory to become corrupted and either an immediate exception occurs, or an exception occurs during some later processing (usually in C rtl functions). Easily duplicated with the following code: $ TYPE BREAK.COM $ CXX /OBJECT=SHARED.OBJ SYS$INPUT #include extern "C" X() { return 1; } $ LINK/SHAREABLE=SHARED.EXE SHARED.OBJ,SYS$INPUT/OPT symbol_vector=(X=procedure) $ CC /OBJECT=FIND.OBJ SYS$INPUT: #include #include #include $DESCRIPTOR(file,"TEST"); $DESCRIPTOR(symbol,"X"); int main(int argc, char *argv[]) { int status; void *value; printf("seeking %s in %s\n",symbol.dsc$a_pointer,file.dsc$a_pointer); status = lib$find_image_symbol (&file, &symbol, &value, 0); lib$signal(status); printf("status=%d, value=%u\n",status,value); } $ LINK /EXECUTABLE=FIND.EXE FIND.OBJ $ DEFINE TEST SYS$DISK:[]SHARED.EXE $ RUN FIND $ SET VERIFY $ @BREAK.COM $ CXX /OBJECT=SHARED.OBJ SYS$INPUT #include extern "C" X() { return 1; } $ LINK/SHAREABLE=SHARED.EXE SHARED.OBJ,SYS$INPUT/OPT symbol_vector=(X=procedure) $ CC /OBJECT=FIND.OBJ SYS$INPUT: #include #include #include $DESCRIPTOR(file,"TEST"); $DESCRIPTOR(symbol,"X"); int main(int argc, char *argv[]) { int status; void *value; printf("seeking %s in %s\n",symbol.dsc$a_pointer,file.dsc$a_pointer); status = lib$find_image_symbol (&file, &symbol, &value, 0); lib$signal(status); printf("status=%d, value=%u\n",status,value); } $ LINK /EXECUTABLE=FIND.EXE FIND.OBJ $ DEFINE TEST SYS$DISK:[]SHARED.EXE $ RUN FIND seeking X in TEST %SYSTEM-S-NORMAL, normal successful completion %SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=00000034, PC=0048A064, PS=0000001B %TRACE-F-TRACEBACK, symbolic stack dump follows Image Name Module Name Routine Name Line Number rel PC abs PC CMA$RTL 0 00030064 0048A064 0 8036B2C8 8036B2C8 0 8036F158 8036F158 FIND .MAIN. main 2536 00000124 00030124 FIND .MAIN. __main 0 00000058 00030058 0 BD5C48F0 BD5C48F0 %SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=00000034, PC=0048A064, PS=0000001B Improperly handled condition, image exit forced. Signal arguments: Number = 00000005 Name = 0000000C 00000000 00000034 0048A064 0000001B Register dump: R0 = 0000000000000001 R1 = 0000000000000000 R2 = 000000000045DBA0 R3 = 0000000000000000 R4 = 00000000001462C1 R5 = 00000000002C2EA0 R6 = 0000000000290150 R7 = 00000000002C2ECC R8 = 0000000000000001 R9 = 000000007FFA0410 R10 = 000000007FFA1190 R11 = 000000007FFBE3E0 R12 = 000000000000005D R13 = FFFFFFFFBD5C76A8 R14 = 0000000000000000 R15 = 0000000000000000 R16 = 0000000000000034 R17 = 00000000001445A8 R18 = 000000000000001D R19 = 0000000000030000 R20 = 0000000000522758 R21 = 0000000000000018 R22 = 0000000000522780 R23 = 00000000005226E0 R24 = 000000000051EA68 R25 = 0000000000000001 R26 = 000000000049A188 R27 = 000000000046C300 R28 = FFFFFFFFFFFFFF50 R29 = 000000007FD2AC60 PC = 000000000048A064 PS = 200000000000001B $ The fix is to make sure the image doing the lib$find_image_symbol is linked against the DEC CXX rtl. -- ------------------------- Roy Westfall westfall@telecheck.com The views expressed here are not necessarily shared by my employer.