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

Home » Public Forums » archive » Re: how can i call a compiled fortran code from IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: how can i call a compiled fortran code from IDL? [message #33956 is a reply to message #33952] Thu, 06 February 2003 06:27 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
"mads" <madhu@erc.msstate.edu> writes:

> Hi,
> I have a compiled FORTRAN code and I need to call it from a procedure in
> IDL. The FORTRAN code does not require any i/p. It reads everything from a
> data file and creates a data file as o/p.
> Madhu

It's been a long, long time since I last did this, and there are probably more
modern ways to do it, but I was able in the past to use LINKIMAGE to link
Fortran procedures into IDL. The secret was to put a C wrapper around the
Fortran. For example, here is a C wrapper for some software that I'm still
using, where the IDL input and output arguments are converted via C into the
kind of things that Fortran can understand. (For some strange reason, when the
Fortran routine is called from C, it ends up with an extra "_" appended to its
name.) Probably something similar can be done with a DLM.

You can see all the C and Fortran code, plus make files for some different
platforms, at

ftp://sohoftp.nascom.nasa.gov/solarsoft/gen/idl_external/

Bill Thompson


#include <stdio.h>

void f_median_c(argc, argv)
int argc; /* The number of arguments */
void *argv[]; /* The arguments */
{
float *in, *out, *missing, *workspace;
long *ndim1, *ndim2, *n_width1, *n_width2;

/* Convert the IDL input parameters into FORTRAN parameters. */

in = (float *) argv[0];
out = (float *) argv[1];
ndim1 = (long *) argv[2];
ndim2 = (long *) argv[3];
n_width1 = (long *) argv[4];
n_width2 = (long *) argv[5];
missing = (float *) argv[6];
workspace = (float *) argv[7];

/* Call the FORTRAN routine F_MEDIAN. */

f_median_(in,out,ndim1,ndim2,n_width1,n_width2,missing,works pace);
return;
}
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Postscript output mods
Next Topic: Re: XROI in IDL5.6 on MAC OS 10.2?

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

Current Time: Sun Oct 12 06:44:10 PDT 2025

Total time taken to generate the page: 0.88143 seconds