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

Home » Public Forums » archive » Re: Guide: how to call Fortran from IDL in a portable and stardard F 2003 way
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Guide: how to call Fortran from IDL in a portable and stardard F 2003 way [message #87809] Thu, 27 February 2014 09:01 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
negri.andre@gmail.com writes:

> Recently, I felt the necessity (in IDL) of a subroutine that was coded extremely well in Fortran, with a skilled use of nested do loops over some matrices. I though that the time was come to interface IDL and Fortran.

Hi Andre,

Nice article! Can I make this available to the community by putting it
on my web page?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Guide: how to call Fortran from IDL in a portable and stardard F 2003 way [message #87818 is a reply to message #87809] Thu, 27 February 2014 09:34 Go to previous messageGo to next message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Thursday, February 27, 2014 5:51:08 PM UTC+1, negri...@gmail.com wrote:

> Recently, I felt the necessity (in IDL) of a subroutine that was coded extremely well in Fortran, with a skilled use of nested do loops over some matrices. I though that the time was come to interface IDL and Fortran.

Nowadays I use /AUTO_GLUE in CALL_EXTERNAL. Here is a Fortran 77 example (I used Fortran 30 years ago :-):

test.f:
subroutine test(array, n,m)
integer*4 n, m
real*8 array(n,m)
write(*,*) array
end

gfortran -c -fPIC test.f
gfortran -shared -o test.so test.o

test.pro:

pro test
n=3l
m=4l
array=dindgen(m,n)
trash=call_external('test.so', 'test_', array, n, m, /auto_glue)
end

IDL> test
% Compiled module: TEST.
0.0000000000000000 1.0000000000000000 2.0000000000000000 3.0000000000000000 4.000000000000000
0 5.0000000000000000 6.0000000000000000 7.0000000000000000 8.0000000000000000 9.000000000
0000000 10.000000000000000 11.000000000000000


regards,
Lajos
Re: Guide: how to call Fortran from IDL in a portable and stardard F 2003 way [message #87828 is a reply to message #87818] Thu, 27 February 2014 10:57 Go to previous message
Andrea[1] is currently offline  Andrea[1]
Messages: 7
Registered: November 2010
Junior Member
David, of course you can!
Lajos, very nice, so it is possible to use auto_glue also for Fortran, I wasn't aware of this possiblity. Maybe in the GDL case you have to use the "old" way, but I'm not sure.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Help needed for a CASE statement, something subtle going on ...
Next Topic: Remote X server

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

Current Time: Wed Oct 08 15:06:55 PDT 2025

Total time taken to generate the page: 0.00601 seconds