![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: SHARED OBJECTS. I create a shared object and then examine the shared object using analyze. This shows that the image is sharable and that the entry vectors are defined. Analyze Image 9-AUG-2001 14:20:51.62 Page 1 MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;8 ANALYZ A07-04 This is an OpenVMS Alpha image file IMAGE HEADER Fixed Header Information image format major id: 3, minor id: 0 header block count: 2 image type: shareable (EIHD$K_LIM) global section major id: %X'04', minor id: %X'660AE9' match control: ISD$K_MATEQU I/O channel count: default I/O pagelet count: default Symbol Vector Virtual Address: %X'000140F0' Symbol Vector Size: 32 bytes Virtual Memory Block Size: 65536 (BPAGE = 16) Fixup Section Virtual Address: %X'00190000' linker flags: (0) EIHD$V_LNKDEBUG 0 (1) EIHD$V_LNKNOTFR 0 (2) EIHD$V_NOP0BUFS 0 (3) EIHD$V_PICIMG 1 (4) EIHD$V_P0IMAGE 0 (5) EIHD$V_DBGDMT 1 (6) EIHD$V_INISHR 1 (7) EIHD$V_XLATED 0 (8) EIHD$V_BIND_CODE 0 (9) EIHD$V_BIND_DATA 0 (10) EIHD$V_MKTHREADS 0 (11) EIHD$V_UPCALLS 0 (12) EIHD$V_OMV_READY 0 (13) EIHD$V_EXT_BIND_ 0 system version (major/minor): 3.0 system version array empty .... 4. GLOBAL SYMBOL DIRECTORY (EOBJ$C_EGSD), 120 bytes 1) Universal Symbol Specification (EGSD$C_SYMG) data type: DSC$K_DTYPE_Z (0) symbol flags: (0) EGSY$V_WEAK 0 (1) EGSY$V_DEF 1 (2) EGSY$V_UNI 1 (3) EGSY$V_REL 1 (4) EGSY$V_COMM 0 (5) EGSY$V_VECEP 0 (6) EGSY$V_NORM 1 psect: 0 value: 16 (%X'00000010') symbol vector entry (procedure) %X'00000000 000458BC' Analyze Image 9-AUG-2001 14:20:51.62 Page 9 MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;8 ANALYZ A07-04 %X'00000000 00010E18' symbol: "GET_PREPAID_BILL" 2) Universal Symbol Specification (EGSD$C_SYMG) data type: DSC$K_DTYPE_Z (0) symbol flags: (0) EGSY$V_WEAK 0 (1) EGSY$V_DEF 1 (2) EGSY$V_UNI 1 (3) EGSY$V_REL 1 (4) EGSY$V_COMM 0 (5) EGSY$V_VECEP 0 (6) EGSY$V_NORM 1 psect: 0 value: 0 (%X'00000000') symbol vector entry (procedure) %X'00000000 00044ABC' %X'00000000 00010D80' symbol: "GET_CONTRACT_BILL" But when I run the following program I cannot find the entry vectors in the sharable image. #include "stdio.h" #include <dlfcn.h> int main (void) void *handle = NULL; int i = 0; void *fp = NULL; char *err = NULL; err = dlerror(); handle = dlopen("MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE", RTLD_NOW); err = dlerror(); fp = dlsym(handle, "GET_PREPAID_BILL"); err = dlerror(); if (fp == NULL) { printf ("NO NO Noooooo\n"); } else { printf ("OOOoooooo YES!\n"); } When I try to link against this sharable image the linker goes nuts... MTNA05 $@lc-main %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 1 is illegal (3.) %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 2 is illegal (1.) %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 3 is illegal (0.) %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 4 is illegal (1.) %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 5 is illegal (12425.) %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 6 is illegal (992.) %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 7 is illegal (49.) %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 8 is illegal (1152.) %LINK-W-RECTYP, file MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]TEST.EXE;14 record 9 is illegal (1852.)..... The link script is MTNA05 $type lc-main.com LINK/ALPHA/NOUSERLIBRARY/TRACE/DEBUG/MAP=MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2] MAIN.MAP;- /EXE=MTN_DEV1:[USERS.MD.OBJECT_BROKER.LIB_2]MAIN.EXE;/SYSEXE MAIN.obj,TEST.EXE/SHARE,[USERS.MD.LIB]LIBMD/LIB,- ORA_OLB:LIBSQL/LIB,ORA_OLB:RDBMS_OBJLIB/LIB,ORA_OLB:ORACLIENT_64/OPT,SYS$INPUT/O PT It seems to make no difference if I use the install utility to install test.exe The Answer is : Please read through the Shareable Image Cookbook, available at the main Ask The Wizard webpage -- the shareable image was (incorrectly) specified as an object file, and the LINKER is reporting that the contents of an input object file do not have the expected format. The Shareable Image Cookbook describes how to design, create, and use a shareable image. The use of dynamic image activation (via the C dlopen call or via the OpenVMS run-time library routine lib$find_image_symbol) to dynamically activate a shareable image is generally not used when the image is already linked against the shareable image. Put another way, if you expect to dynamically load the image then you probably do not want to include the shareable image when linking the other image(s) of the application program. The dlopen and dlsym calls use the lib$find_image_symbol routine that is referenced in The Sharable Image Cookbook. Related topics include (1314), (2002), (2486), (6363), etc.
|