Re: How to call C program from IDL?? [message #18729] |
Tue, 01 February 2000 00:00 |
Nigel Wade
Messages: 286 Registered: March 1998
|
Senior Member |
|
|
Vineel Kumar Gattu wrote:
>
> Hi,
>
> I have a C program which I would like to call from my IDL routine.
> Can anybody give some suggestions?
>
> Thanks in advance,
> Vineel
It rather depends on what your C program does.
If it is a standalone executable then you could use the SPAWN
command to run it.
If it is a function/library which you want to link into IDL then you
need to use either CALL_EXTERNAL or LINKIMAGE (or a DLM). CALL_EXTERNAL
is the simplest to use, and if you can create all the data it uses in
IDL before you call it then that's the way to go.
If you need to return complex structures/arrays or give IDL access to
dynamically allocated data then you have to use LINKIMAGE (or a DLM).
LINKIMAGE has a much steeper learning curve and has much more potential
for completely screwing up IDL.
Take a look at the External Developement Guide. This explains both
CALL_EXTERNAL and LINKIMAGE.
--
-----------------------------------------------------------
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523568, Fax : +44 (0)116 2523555
|
|
|
Re: How to call C program from IDL?? [message #18743 is a reply to message #18729] |
Sun, 30 January 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Vineel Kumar Gattu (vineel@CS.Arizona.EDU) writes:
> I have a C program which I would like to call from my IDL routine.
> Can anybody give some suggestions?
Use Call_External and make sure you are using long
integers on the IDL side. Also make sure all variables
are declared on the IDL side (although they can be
populated on the C side). That's about all the
advice you are likely to need. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|