Direct access to pointer and object reference heap variables (types IDL_TYP_PTR and IDL_TYP_OBJREF, respectively) is not allowed. Rather than accessing the heap variable directly, store the value of the heap variable (an IDL pointer or object reference) in a regular IDL variable at the IDL user level. Access the data in the regular variable, then store the results back in the heap variable (via the pointer or object reference) when done.
Note: You can use IDL’s TEMPORARY function to avoid making copies of the data.