next up previous 252
Next: F77_CREATE_CHARACTER_ARRAY - Create a FORTRAN CHARACTER array
Up: Full Description of F77 Macros
Previous: F77_CHARACTER_TYPE - Define the type CHARACTER


F77_CREATE_CHARACTER - Create a FORTRAN CHARACTER variable

Description:
Create a CHARACTER variable that will be passed to a FORTRAN routine using the CHARACTER_ARG macro. Use this macro, in combination with the DECLARE_CHARACTER_DYN and F77_FREE_CHARACTER macros, where the length of the CHARACTER string is not known until run time. A pointer to the actual string of characters and an integer variable giving the length of the string are set.

Invocation:
F77_CREATE_CHARACTER(arg,length)

Arguments:

arg
The variable being created.
length
The length of the character string. This will usually be a variable name or expression of type int.

Examples:

F77_CREATE_CHARACTER(fstring,strlen(cstring))
will expand as follows:

All Unix: fstring_length = strlen(cstring);
  fstring = cnfCref(fstring_length)
VAX/VMS: fstring_arg = cnfCref(strlen(cstring));
  fstring = fstring_arg->pointer;
  fstring_length = fstring_arg->length


Notes:
On VMS, the expansion of the macro is quite complex. A descriptor structure and a pointer to it are set up in addition to the pointer to the actual string of characters and the length of the string. (The address of the descriptor is what is actually passed to the called FORTRAN routine.)



next up previous 252
Next: F77_CREATE_CHARACTER_ARRAY - Create a FORTRAN CHARACTER array
Up: Full Description of F77 Macros
Previous: F77_CHARACTER_TYPE - Define the type CHARACTER

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