Computing.Net > Forums > OpenVMS > Open VMS / C programming

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Open VMS / C programming

Reply to Message Icon

Name: singaporedeb
Date: January 25, 2004 at 22:02:43 Pacific
OS: Open VMS
CPU/Ram: 256
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: lsk55
Date: January 27, 2004 at 18:43:59 Pacific
Reply:

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.


0

Response Number 2
Name: VMSFan
Date: January 28, 2004 at 16:24:33 Pacific
Reply:

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.)


0

Response Number 3
Name: singaporedeb
Date: February 10, 2004 at 01:50:44 Pacific
Reply:

thanks for your help :-)


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to OpenVMS Forum Home


Sponsored links

Ads by Google


Results for: Open VMS / C programming

Interrupt I/O In C Program www.computing.net/answers/openvms/interrupt-io-in-c-program/145.html

What is Open VMS you ask www.computing.net/answers/openvms/what-is-open-vms-you-ask/5.html

Open VMS Post-Installation Help www.computing.net/answers/openvms/open-vms-postinstallation-help/287.html