Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
There is a VMS DCL command "analyze/image" which can pick up a fortran source files version number. Does anyone know whether its possible to do this in C and if so what is the code I need to enter in the .C file?

If you use an options file with LINK you can place an IDENT specifier. I don't recall how long this string can be... but it gets imbedded in the EXE. Although I've never done it, I've seen this in the documentation. At the time I thought that this might make a good mechanism for retaining version number in the executable image. I hope this helps, Deb.

If all you want is the file version number of the executable, you can use the $GETJPI/$GETJPIW or LIB$GETJPI services to obtain the image file name (JPI$_IMAGNAME code) and then either parse out the version number yourself or use $FILESCAN.
If you want image identification information, you could try this (depending on your level of comfort) after obtaining the image file name:
1) Extract IHDDEF and IHIDEF from SYS$LIBRARY:LIB.REQ (VAX) or EIHDDEF and EIHIDEF from SYS$LIBRARY:LIB.MLB (AXP)
2) Use IHDDEF and IHIDEF to define overlays (struct) which you will use to interpret the image file header
3) Open the image file as a file of 512 byte records
4) From the first block, use HDRBLKCNT to determine the size of a buffer and allocate that number of pages (ie. to a pointer)
5) Copy that number of blocks from the file to the buffer
6) Close the file; use the overlays to first find the IHI offset in the IHD (IMGIDOFF) and then to read from the IHI (eg. IMGNAM, IMGID); deallocate the buffer
A simpler way: create a .COM file to dump and parse the results of ANALYZE/IMAGE into a temporary text file (or logical name); use LIB$SPAWN (synchronous completion) to run the .COM file and then read/delete the temporary file/logical.
(If there is an undocumented system service to make this all simpler, I don't know what it is.)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |