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.)