DECLARE_CHARACTER_DYN
- Declare a CHARACTER variable
Description:
Declare a CHARACTER variable that will be passed to a FORTRAN routine
using the CHARACTER_ARG macro. Use this macro, in combination with
the F77_CREATE_CHARACTER and F77_FREE_CHARACTER
macros, where the length of the CHARACTER string is not known until
run time.
Invocation:
DECLARE_CHARACTER_DYN(arg)
Arguments:
arg
The variable being declared.
Examples:
DECLARE_CHARACTER_DYN(fstring)
will expand as follows:
All Unix:
char *fstring; int fstring_length
VAX/VMS:
char *fstring; int fstring_length
struct dsc$descriptor_s *fstring_arg
Notes:
On VMS, the expansion of the macro is quite complex.
A pointer to a descriptor structure is declared in addition to a
pointer to char (used to point to the actual string of characters)
and an int variable to store the length of the array. The address
of the descriptor is what is actually passed to the called FORTRAN
routine.
CNF and F77 Mixed Language Programming -- FORTRAN and C Starlink User Note 209 P.M. Allan A.J. Chipperfield R.F. Warren-Smith 19 January 2000 E-mail:ussc@star.rl.ac.uk