[comp.os.vms] LIB$ functions from C

dalegass@dalcsug.UUCP (Dale Gass) (02/12/88)

I'm having considerable trouble accessing the LIB$ functions from VMS C
(specifically LIB$FIND_FILE).  I believe the problem is in the parameter 
passing.  What must be done to make the parameters acceptable by the library
functions?  I've searched and searched throughout VMS's maze of tree-structured
help screens, but haven't found anything relevant...

-dalegass@dalcsug

scjones@sdrc.UUCP (Larry Jones) (02/14/88)

In article <339@dalcsug.UUCP>, dalegass@dalcsug.UUCP (Dale Gass) writes:
> I'm having considerable trouble accessing the LIB$ functions from VMS C
> (specifically LIB$FIND_FILE).  I believe the problem is in the parameter 
> passing.  What must be done to make the parameters acceptable by the library
> functions?  I've searched and searched throughout VMS's maze of tree-structured
> help screens, but haven't found anything relevant...
> 
> -dalegass@dalcsug

Instead of searching through the on-line help, hows about searching through
the manuals? :-)

Seriously, I believe there are a number of excellent examples of calling
library routines and system services in the VAX C manual.
-- 

----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                MAIL: 2000 Eastman Dr., Milford, OH  45150
                                    AT&T: (513) 576-2070
"When all else fails, read the directions."

hildum@iris.ucdavis.edu (Eric Hildum) (02/14/88)

Hello.

About passing parameters to the run time library functions, the
following documents may be of use:

Programming in VAX C (AA-L370B-TE)	Chapter 14

VAX/VMS Run-Time Library Routines Reference Manual (AA-Z502C-TE)
					Part 1	Section 1-2

Guide to Creating Modular Procedures on VAX/VMS (AA-FB84A-TE)

Introduction to VAX/VMS System Routines (AA-Z500B-TE)

Please take the time to look these over, as they will answer almost
all questions you could have about calling routines on VAX/VMS.

				Eric
				dehildum@ucdavis.ucdavis.edu	(Internet)
				dehildum@ucdavis.bitnet	(BITNET)
				ucbvax!ucdavis!dehildum	(uucp)

kurtk@tekcae.TEK.COM (Kurt Krueger) (02/18/88)

I believe the problem lies in the fact that LIB$ routines almost always want
character data passed by DESCRIPTOR.  Fortran does this automatically, but
C doesn't.  Read the section about calling from C and pay close attention
to descriptors.  There is even a macro provided for creating a descriptor
for a constant string.

#include descrip.h
$DESCRIPTOR(string,"[USER]THIS.IS.THE.PATH");
	LIB$whatever(&string); /* Pass the ADDRESS of the descriptor */

For more advanced use, you will need to access the individual fields of the
$DESCRIPTOR structure.