IDL and DLL under windows [message #24650] |
Tue, 10 April 2001 01:43 |
StefanoM
Messages: 5 Registered: April 2001
|
Junior Member |
|
|
sorry for this long post.
well, I would like to use my Fortran subroutine with IDL.
To do this I have created a DLL whit MS Develop. Studio and then called the
subroutines from IDL with CALL_EXTERNAL. The problem is that ... it doesn't
work!!! This could be related to the way the parameters are passed to the
soubroutines, by value or by reference. If I simply compile and link the
subroutines 'as they are' into a DLL, then it is impossible to call them
from IDL, otherwise, if I follow the example given with IDL (5.2):
SUBROUTINE SUM_ARRAY(argc, argv) !Called by IDL
INTEGER*4 argc, argv(*) !Argc and Argv
are integers
j = LOC(argc)
!Obtains the number of arguments (argc)
!Because argc is passed by VALUE.
c Call subroutine SUM_ARRAY1, converting the IDL parameters
c to standard FORTRAN, passed by reference arguments:
CALL SUM_ARRAY1(%VAL(argv(1)), %VAL(argv(2)), %VAL(argv(3)))
RETURN
END
c This subroutine is called by SUM_ARRAY and has no
c IDL specific code.
c
SUBROUTINE SUM_ARRAY1(array, n, sum)
INTEGER*4 n
REAL*4 array(n), sum
sum=0.0
DO i=1,n
sum = sum + array(i)
ENDDO
RETURN
END
I get errors during the linking of the DLL, in particular: 'undefined
symbol' related to the subroutine (SUM_ARRAY1) called from the 'interface'
subroutine (i.e. SUM_ARAY that manages the passage of the parameters from
IDL to DLL).
Does anyone have experience about this ? Any suggestion ?
Stefano
stefano.massetti@katamail.com
|
|
|