X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Apr 2007 10:08 AM by  anon
IDL Could not find compiled routine
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
29 Apr 2007 10:08 AM
    since IDL 6.3 there is a strange behaver: while compiling functions calling not yet defined function IDL doesn't report errors. More over, RESOLVE_ALL also doesn't report the problem. But while running the program, IDL stops with error (the procedure was compiled without knowladge about the calling function). It is obvious, that calling the function from command line works fine (the function is compiled, although after the procedure in question). The big problem concerning this feature is that writing big programs it is difficult to look after functions order. I think RESOLVE_ALL _MUST_ report this problem. How can i check my program for functions wrong order? Here is the test file and log file demonstrating the situation ------------------ test.pro -------------------- pro test print, A(5) end function A, x return, x end ---------------------------------------------------- -------------- Console Log ------------------ IDL> .COMPILE '/home/ps/test.pro' % Compiled module: TEST. % Compiled module: A. IDL> resolve_all % Compiled module: RESOLVE_ALL. % Compiled module: PATH_SEP. % Compiled module: UNIQ. IDL> test % Variable is undefined: A. % Execution halted at: TEST 2 /home/ps/test.pro % $MAIN$ IDL> print, a(5) 5 ----------------------------------------------------

    Deleted User



    New Member


    Posts:
    New Member


    --
    29 Apr 2007 10:08 AM
    I am surprised that IDL acts this way, but there are two practises that IDL documentation DOES advise programmers to employ to avoid this problem: 1. The routine whose name matches the file name should be the last routine coded in the '.pro' file. I can not think of any good reason to not follow this practise in every single '.pro' file you write. 2. IDL Documentation highly recommends that users use only square brackets "[ ]" in array definitions and that programmers following that practise should then always start their routines with the compiler option: COMPILE_OPT STRICTARR If you do this, then the statement "A(5)" will NEVER throw the error "Variable is undefined". It will either find the compiled 'A( )' function, or, if not yet compiled, it will find the file 'a.pro' in the IDL Search Path, or it will throw an error that "The Routine A could not be found", a much easier error message to debug. James Jones
    You are not authorized to post a reply.