OpenVMS Source Code Demos

basic_calling_c_demo4

1000	!=================================================================================================
	! title  : basic_calling_c_demo4.bas
	! author : Neil Rieck	(https://neilrieck.net) (mailto:[email protected])
	! what   : passing string data from BASIC to C (and back again)
	! build  : bas  basic_calling_c_demo4
	!	 : cc   basic_calling_c_demo4_part2
	!	 : link basic_calling_c_demo4,		-
	!		basic_calling_c_demo4_part2
	! history:
	! ver who when   what
	! --- --- ------ ---------------------------------------------------------------------------------
	! 100 NSR 151209 original effort
	!=================================================================================================
	option type=explicit							!
	declare string constant k_program = "basic_calling_c_demo4"
	!
	external long function basic_calling_c_demo_c1(string by desc)
	!
	!	global variables (BASIC only)
	!
	declare string	gMain$				,	&
		long	rc
	!=======================================================
	!	main
	!=======================================================
	main:
	print "-i-program: "+k_program 				!
	gMain$		= "hello there"				! init variables
	!
	print "-i-gMain$ = "; gMain$				!
	print "-i-calling function c1"				!
	rc = basic_calling_c_demo_c1(gMain$)			!
	!
	print "-i-back in: "+k_program				!
	print "-i-rc:";rc					!
	print "-i-gMain$ = "; gMain$				!
	!
	print "-i-exiting: "+k_program				!
	end program (1)						! VMS-s-

home Back to Home
Neil Rieck
Waterloo, Ontario, Canada.