X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 13 Jun 2006 05:47 AM by  anon
pointer array sharing
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
13 Jun 2006 05:47 AM
    Does anyone know how to pass a pointer array between functions? I created a pointer array (PTRARR) in a function and when I try to pass it to the main calling procedure the heap variables are different and therefore the data saved in the heap variables is lost. I tried declaring the pointer array as a COMMON block but that did not work either. Thank you,

    Deleted User



    New Member


    Posts:
    New Member


    --
    13 Jun 2006 05:47 AM
    I wonder why you have any problem passing around pointer references in IDL. It should not need a COMMON block at all. Notice how this simple pair of IDL routines work together: FUNCTION return_ptr_data x = findgen(10) * 2.5 ptrX = ptr_new(x) return, ptrX END PRO return_ptr_data_driver myptr = return_ptr_data() print, *myptr END I could also write the above this way: PRO return_ptr_data, myptr x = findgen(10) * 2.5 myptr = ptr_new(x) END PRO return_ptr_data_driver return_ptr_data, myptr print, *myptr END and passing the pointer through a procedure argument works just as well. Can you see what your code is doing differently that the pointer assignment would fail to pass correctly between two different IDL routines?
    You are not authorized to post a reply.