STRUCTREF Function
Returns a list of all existing references to a structure.
Usage
result = STRUCTREF({structure})
Input Parameters
structure—The structure name. The name can be specified as {structure}, "structure", or x , where x is a variable of type structure.
Returned Value
result—A list of the variables, structures, definitions, and common blocks that reference structure.
Keywords
None.
Discussion
Use STRUCTREF before you use DELSTRUCT to check if the structure you want to delete is currently referenced by any variables, common blocks, or other structure definitions.
You cannot delete a structure that is currently referenced.
If you want to delete a structure that is referenced, you can either:
Delete the references (variables, structures, etc.) returned by STRUCTREF, and then use the DELSTRUCT procedure.
Use the DELSTRUCT procedure with the
Rename keyword. This renames the structure.
If you are trying to free memory, then you must pursue the first option. If you want to delete a structure, and memory is not a concern, then the second option is probably the best choice.
Example
x = {struct1, a:float(0)}
PRINT, STRUCTREF(x)
; PV-WAVE prints: <procedure $MAIN$, symbol X>
See Also
For more information on structures, see the PV‑WAVE Programmer’s Guide.
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.