Re: An Callable IDL Question [message #66303] |
Mon, 04 May 2009 00:52  |
hy.rs.whu
Messages: 2 Registered: May 2009
|
Junior Member |
|
|
On 4月30日, 下午8时19分, "Haje Korth" <some...@somewhere.com> wrote:
> I do not use callable IDL, but one question occurred to me. Do you restore
> the sav file before invoking the function? Haje
>
> <hy.rs....@gmail.com> wrote in message
>
> news:4b635c0d-4d23-42b1-80af-7baec64e9b3a@z16g2000prd.google groups.com...
>
>> I wrote a c program in which I want to use Callable IDL to plot and
>> analysis some RS data.
>
>> First, I invoke IDL command in c program using function IDL_ExecuteStr
>> (). But it's hard to debug and I can't get any error information when
>> something wrong.
>
>> So I found out a solution. I wrote procedures and funcitons in IDL
>> IDE, so I can test and debug easily. When the code was tested good, I
>> save them as .sav file using SAVE command. If my solution works, I
>> could restore the function and invoking them in my c program.
>
>> But my solution faild. I couldn't invoke procedures and functions
>> in .sav file when I using Callable IDL.
>
>> I'm not sure whether my solution is right or wrong. So I ask your
>> help. Tell me the feasibility of my solution, please!
>
>
The answer is yes.
Following are my test IDL and C code segment:
IDL:
PRO fsplot, dimx, dimy
PLOT, dimx, dimy
END
C:
int main(int argc, char* argv[])
{
IDL_INIT_DATA init_data;
init_data.options = IDL_INIT_NOCMDLINE;
if (argc) {
init_data.options |= IDL_INIT_CLARGS;
init_data.clargs.argc = argc;
init_data.clargs.argv = argv;
}
if (IDL_Initialize(&init_data)) {
IDL_ExecuteStr("RESTORE, 'fsplot.sav'");
IDL_ExecuteStr("fsplot, [1,2,3], [1,2,3]");
IDL_Cleanup(FALSE); /* Don't return */
}
return 0;
}
|
|
|