[comp.os.vms] using UIS routines with C

winalski@psw.DEC.COM (Paul S. Winalski) (09/10/87)

The problem with your call to UIS$CREATE_DISPLAY is with the use of floating
constants in the routine argument list.  VAX C floating point constants are
of type double, not type float (see GUIDE TO VAX C, section 6.4.1, Floating-
Point Constants).  Furthermore, C passes arguments by value, whereas the
arguments to UIS$CREATE_DISPLAY are all by reference.  The ACCVIO occurs
because you are passing in D-float values and UIS$CREATE_DISPLAY is trying to
use them as the addresses of F-float values.
 
Something similar to the following ought to work:
 
	#include <stdio.h>
	#include <uisentry.h>
	#include <uisusrdef.h>
 
	main()
	{
	long int vd_id;
	float one = 1.0;
	float ten = 10.0;
	float twenty = 20.0;
 
	vd_id = uis$create_display(&one, &one, &twenty, &twenty, &ten, &ten);
	printf("created virtual display\n");
 
	}
 
Unfortunately, UISENTRY.H doesn't use function prototypes, which would have
caught this error at compile time.  I don't think function prototypes were
implemented in VAX C at the time that UISENTRY.H was written.
 
--PSW