Search code examples
compilationidl-programming-language

compiling file having path in variable (IDL)


Usually when I want to compile a file I can use

.compile /home/.../file.pro

But assume I have this path in variable only. Then the code below

path = '/home/.../file.pro'
.compile path

returns error because compiler thinks path is a file and it can't find it. How can I avoid this?


Solution

  • What you want to use is the RESOLVE_ROUTINE command. It takes the file name as a string, (So you can pass it inside a variable), and has a few keywords; IS_FUNCTION being the one you're probably going to need to use the most. Use /IS_FUNCTION to compile functions, and leave it out to compile procedures.

    Here's the documentation:

    http://www.physics.nyu.edu/grierlab/idl_html_help/R45.html#wp1073539