OpenVMS header files and descrip.h

Here you can discuss the universal Integrated Development Environment for OpenVMS.
Post Reply
User avatar

Topic author
ajbrehm
Valued Contributor
Posts: 62
Joined: Sun Jun 16, 2019 7:55 am
Reputation: 6
Location: Zurich
Status: Offline
Contact:

OpenVMS header files and descrip.h

Post by ajbrehm » Sat Jul 20, 2019 12:22 pm

I copied the OpenVMS header files from DKA0:[SYS0.SYSCOMMON.DECC$LIB.REFERENCE.SYS$STARLET_C] which appears to work. However, I appear to be missing a file DESCRIP.H.

What did I misunderstand?

Added in 3 hours 32 minutes 4 seconds:
I noticed when I create a file test.c with an #include <descrip.h> on the VMS system, cc does not complain about a non-existing descrip.h. But I cannot find a descrip.h anywhere on the VMS file system.

When I write a C file in Visual Studio Code and include a fake descrip.h (which I created), the call to $DESCRIPTOR() works (but is marked as an error in the IDE). The C file then compiles on the VMS system and the system call works.

Specifically I did a

$DESCRIPTOR(tt, "SYS$OUTPUT");
unsigned short int channel;
sys$assign(&tt, &channel, 0, 0, 0);
char *s = "Hello from sys$qiow!\n";
int length=strlen(s);
sys$qiow(0, channel, IO$_WRITEVBLK, &iosb, 0, 0, s, length, 0, 0, 0, 0);

The "tt" in $DESCRIPTOR is marked by the IDE as an error since $DESCRIPTOR does not exist (since descrip.h does not exist). But it compiles and runs.

I am imagining that the parameter after the string (length) is indeed the length of the string to output. It appears to work. If I make the parameter bigger, the system call outputs lots of question marks after my string s.

Where is descrip.h supposed to be and why does cc on VMS find it even though dir [...] does not?
Last edited by ajbrehm on Sat Jul 20, 2019 5:09 pm, edited 4 times in total.

User avatar

Topic author
ajbrehm
Valued Contributor
Posts: 62
Joined: Sun Jun 16, 2019 7:55 am
Reputation: 6
Location: Zurich
Status: Offline
Contact:

Re: OpenVMS header files and descrip.h

Post by ajbrehm » Sun Jul 21, 2019 5:50 am

In the mean time someone who must have read this forum sent me a note (via my Web site, so I don't know who he was) explaining that the header files in [.DECC$LIB.REFERENCE] are likely out of date and that cc uses DECC$RTLDEF.TLB. I have to extract the header files from there to use them with VS Code.

(I think the VMS-IDE extension should really come with all the necessary header files.)

Added in 4 hours 5 minutes 2 seconds:
I extracted DESCRIP from DECC$RTLDEF.TLB and added it to my existing directory of header files as DESCRIP.H. I hope this is all I need.

User avatar

martinv
Master
Posts: 102
Joined: Fri Jun 14, 2019 11:05 pm
Reputation: 0
Location: Goslar, Germany
Status: Offline
Contact:

Re: OpenVMS header files and descrip.h

Post by martinv » Mon Jul 22, 2019 1:16 am

Quoting from the output of the HP C installation procedure:
The C Runtime Library headers and Starlet headers are installed as a Text Library (.TLB). The traditional text form of the headers (.H files) are also provided (for reference purposes only) in the directories: SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF] and SYS$COMMON:[DECC$LIB.REFERENCE.SYS$STARLET_C].
DESCRIP.H is in SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]
Working hard for something we don't care about is called stress;
working hard for something we love is called passion.
(Simon Sinek)

User avatar

Topic author
ajbrehm
Valued Contributor
Posts: 62
Joined: Sun Jun 16, 2019 7:55 am
Reputation: 6
Location: Zurich
Status: Offline
Contact:

Re: OpenVMS header files and descrip.h

Post by ajbrehm » Mon Jul 22, 2019 3:24 am

SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]
This directory is empty.

I didn't install HP C. I use the "hobbyist" student image.

User avatar

martinv
Master
Posts: 102
Joined: Fri Jun 14, 2019 11:05 pm
Reputation: 0
Location: Goslar, Germany
Status: Offline
Contact:

Re: OpenVMS header files and descrip.h

Post by martinv » Mon Jul 22, 2019 4:22 am

Okay, then extracting the module from DECC$RTLDEF.TLB was the right thing to do.
To extract all headers to the designated reference directory, a small DCL program should do the job:

Code: Select all

$ rtldef = "SYS$LIBRARY:DECC$RTLDEF.TLB"
$ dest = "SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]"
$
$ create/directory 'dest'
$
$! get list of all the module names
$ library /list=libr_list.out 'rtldef'
$
$ close/nolog in
$ open/read /end=done_read/error=err in libr_list.out
$
$! skip the text library header
$header_loop:
$ read /end=done_read/error=err in mod_name
$ if ("''mod_name'" .nes. "") then goto header_loop
$
$! now walk the list and extract each one
$loop:
$ read /end=done_read/error=err in mod_name
$ library /extract="''mod_name'"/output='dest''mod_name'.H 'rtldef'
$! files were being created without world read+execute privs
$ set protection=(w:re) 'dest''mod_name'.H
$ goto loop
$done_read:
$ delete /nolog libr_list.out;*
$err:
$ close in
$ exit
(This is based on DECC$EXTRACT_CLD.COM from the C PCSI kit)
Working hard for something we don't care about is called stress;
working hard for something we love is called passion.
(Simon Sinek)


marty.stu
Site Admin
Valued Contributor
Posts: 96
Joined: Tue May 21, 2019 6:56 am
Reputation: 0
Status: Offline

Re: OpenVMS header files and descrip.h

Post by marty.stu » Mon Jul 22, 2019 4:25 am

I extracted DESCRIP from DECC$RTLDEF.TLB and added it to my existing directory of header files as DESCRIP.H. I hope this is all I need.
Hi ajbrehm,

Yes, you used the right method and don't need anything else. To get more information about how the C/C++ compiler finds header files and where they are stored, you can view the following section of the online help: http://mx.isti.cnr.it/cgi-bin/conan?key ... _DIRECTORY
Last edited by marty.stu on Mon Jul 22, 2019 4:25 am, edited 1 time in total.
Run to the bedroom, In the suitcase on the left You'll find my favorite axe.

User avatar

Topic author
ajbrehm
Valued Contributor
Posts: 62
Joined: Sun Jun 16, 2019 7:55 am
Reputation: 6
Location: Zurich
Status: Offline
Contact:

Re: OpenVMS header files and descrip.h

Post by ajbrehm » Mon Jul 22, 2019 7:47 am

For completeness' sake, this is the result of my attempts:

http://desertpenguin.org/blog/hello-openvms.html

Post Reply