Re: how can i call a compiled fortran code from IDL? [message #33952 is a reply to message #33951] |
Thu, 06 February 2003 08:05   |
James Kuyper
Messages: 425 Registered: March 2000
|
Senior Member |
|
|
William Thompson wrote:
...
> ... (For some strange reason, when the
> Fortran routine is called from C, it ends up with an extra "_" appended to its
> name.) ...
It's a naming convention issue, and the naming conventions are different
on different platforms. On some platforms, an '_' is prepended, rather
then appended, on some platforms, both will be needed.
If you have access to HDF, it provides a header "hdfi.h", containing a
number of useful macros for encapsulating what the've learned about
portable Fortran-C coding. FNAME(name) provides the C function name that
will be callable as a Fortran function or subroutine called 'name'; it
adds '_' whereever it's needed, if it's needed. In order to make a C
function work as a Fortran function returning a specified type, you
declared the return type as FRETVAL(type). It also defines a typedef
named 'intf' for an integral C type that has the same representation as
the Fortran INTEGER type.
|
|
|