comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » call_external and IDL_ExecuteStr
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
call_external and IDL_ExecuteStr [message #53093] Wed, 21 March 2007 11:08 Go to previous message
Allan Whiteford is currently offline  Allan Whiteford
Messages: 117
Registered: June 2006
Senior Member
Hi,

Am I allowed to do this:

++++++ callback.c ++++++

#include <stdio.h>
#include "export.h"

void callback(int argc,char *argv)
{
int i;
i=IDL_ExecuteStr("testme");
}

++++++ callback.pro ++++++

pro testme
print,'hey'
end

pro callback
a=call_external('callback.so','callback');
end

++++++ Compilation command ++++++

gcc -shared -o callback.so -I$IDL_DIR/external/ callback.c

---------------------------------?

Looking through the documentation I find:

Note: The functions documented in this chapter should only be
used when calling IDL from other programs their use in code
called by IDL via CALL_EXTERNAL or a system routine (LINKIMAGE,
Dynamically Loadable Module) is not supported and is certain to
corrupt and/or crash the IDL process.

(in help/online_help/Using_Callable_IDL.html)

So I guess that means I'm not allowed to. However, it does work:

IDL> callback
% Compiled module: CALLBACK.
hey
% Temporary variables are still checked out - cleaning up...
IDL>

To put the whole thing in context, I have an IDL application
which calls a FORTRAN subroutine via call_external, this
subroutine can take a few minutes to run and I'd like to display
a progress bar in IDL. To do this I need the FORTRAN to be able
to tell the IDL to update the progress bar. I'd like to be able
to make a call in the FORTRAN to an external IDL subroutine
without having to return control to IDL and then re-enter the
FORTRAN. I guess signals and RPC stuff would be something else
to look at but the above solution is really neat (if it's
safe!).

Is the above note simply scaremongering to reduce support
requests and bug reports or will some really bad happen with the
example code? Is there a better way to achieve the above which
doesn't conflict with the documentation?

I've found:

http://cow.physics.wisc.edu/~craigm/idl/archive/msg00589.htm l

which I guess is the reason for the warning going in to the
documentation. However, if I don't use IDL_ExecuteStr to
allocate memory or anything else I feel it will probably be
fairly safe. Do people have any experience and/or thoughts?

I've also found:

http://cow.physics.wisc.edu/~craigm/idl/archive/msg05117.htm l

where a number of suggestions are made. One, by JD Smith is
suggesting possibly using the same solution as my independent
example above but in a linkimage context. However, I think this
clashes with the documentation note as well. It's often a good
bet to assume JD Smith knows more than the documentation but I'd
like a bit more reassurance.

Any reassurance, warnings or alternative solutions welcome and
very much appreciated.

Thanks,

Allan
[Message index]
 
Read Message
Read Message
Previous Topic: using ion scripts for local server -apache
Next Topic: strange behaviour of bar_plot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Nov 29 00:14:40 PST 2025

Total time taken to generate the page: 0.00222 seconds