X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 02 Oct 2015 12:11 PM by  anon
Object references in the extension code for ENVI
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
02 Oct 2015 12:11 PM
    Hello. I am creating the extension to ENVI that uses some objects that I defined in the myObj__define.pro file. I saved this definition in the same location where I saved my extension code. When I am running my extension from ENVI interface, the object references can not be found, as the myObj__define.pro needs to be compiled first. How can one get around this issue and make the extension with references to the user defined objects work, especially when the extension is targeted for the user (who will not use idl command prompt). Thank you!

    Zachary Norman



    Basic Member


    Posts:173
    Basic Member


    --
    02 Oct 2015 02:52 PM
    Hi Yeni, I think that is something related to IDL's search path. I would suggest adding the directory that stores the code to IDL's search path through the IDL Workbench (Preferences->IDL->Paths) or you can try placing the following in your extensions code: ;find the directory that this code/save file is being run from thisdir = FILE_DIRNAME(((SCOPE_TRACEBACK(/STRUCT))[-1]).FILENAME) ;if not in the path, then append to IDL's search path if ~(!path.contains(thisdir)) then pref_set, 'IDL_PATH', !PATH + ';' + thisdir, /commit That code looks to see if the directory you want to add is in !PATH already, and if it is not, then it is added to the end. You could also try adding the contents for myObj__define before your extension code. IDL will compile the entire file for your extension before running which means that your object should be compiled and ready to use.

    Deleted User



    New Member


    Posts:
    New Member


    --
    05 Oct 2015 11:05 AM
    Hi, thanks for the reply. I resolved the issue. Though, adding a path system variable didn't help. I made a project and compiled all .pro files together to create .sav and put it into the extension folder. I had still the same error for my functions when I call them: "attempt to call undefined method". What is interesting, I had functions in my object definition and when I called them in my extension like myObj->doSomething() or myObj.doSomething() they would occur undefined or I could not built the project at all because of the compile syntax errors. When I would run the same commands from the IDL prompt, they would execute no problem. So I just changed the functions to pro and called as myObj->doSomething. Everything compiled and run from ENVI toolbox as an extension.
    You are not authorized to post a reply.