- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I tried to compile my fortran code to generate a dll, but I got allways the error massage: "error #6633: The type of the actual argument differs from the type of the dummy argument. [%%VAL]" for each of the passed argument.
However, by compilling the same code in the Compaq Visual Fortran compiler it works.
The dll will be called from IDL (Interactive Data Language), where the interface should be:
SUBROUTINE init_E_diss_recomb(argc, argv)
!ms$if .not. defined(LINKDIRECT)
!MS$ATTRIBUTES DLLEXPORT :: init_E_diss_recomb
!ms$endif
! argc and argv are single precission.
real*4 argc, argv(*)
j = LOC(argc)
! Call subroutine init_E_diss_recomb_ converting the IDL parameters
! to standard Fortran, passed by reference arguments:
call init_E_diss_recomb_(%VAL(argv(1)), %VAL(argv(2)), %VAL(argv(3)), %VAL(argv(4)), &
%VAL(argv(5)), %VAL(argv(6)), %VAL(argv(7)), %VAL(argv(8)) , %VAL(argv(9)), &
%VAL(argv(10)), %VAL(argv(11)), %VAL(argv(12)), %VAL(argv(13)))
contains
SUBROUTINE init_E_diss_recomb_(mn, Te, me, Ti, mi, Ebr_number, Ebr_, br, &
simNumber, E_number, dE, distr_all, E)
... program code ...
END SUBROUTINE
END SUBROUTINE
I hope, that someone can help me.
Thanks, Hannes
I tried to compile my fortran code to generate a dll, but I got allways the error massage: "error #6633: The type of the actual argument differs from the type of the dummy argument. [%%VAL]" for each of the passed argument.
However, by compilling the same code in the Compaq Visual Fortran compiler it works.
The dll will be called from IDL (Interactive Data Language), where the interface should be:
SUBROUTINE init_E_diss_recomb(argc, argv)
!ms$if .not. defined(LINKDIRECT)
!MS$ATTRIBUTES DLLEXPORT :: init_E_diss_recomb
!ms$endif
! argc and argv are single precission.
real*4 argc, argv(*)
j = LOC(argc)
! Call subroutine init_E_diss_recomb_ converting the IDL parameters
! to standard Fortran, passed by reference arguments:
call init_E_diss_recomb_(%VAL(argv(1)), %VAL(argv(2)), %VAL(argv(3)), %VAL(argv(4)), &
%VAL(argv(5)), %VAL(argv(6)), %VAL(argv(7)), %VAL(argv(8)) , %VAL(argv(9)), &
%VAL(argv(10)), %VAL(argv(11)), %VAL(argv(12)), %VAL(argv(13)))
contains
SUBROUTINE init_E_diss_recomb_(mn, Te, me, Ti, mi, Ebr_number, Ebr_, br, &
simNumber, E_number, dE, distr_all, E)
... program code ...
END SUBROUTINE
END SUBROUTINE
I hope, that someone can help me.
Thanks, Hannes
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - hgr_iwf
call init_E_diss_recomb_(%VAL(argv(1)), %VAL(argv(2)), %VAL(argv(3)), %VAL(argv(4)), &
%VAL(argv(5)), %VAL(argv(6)), %VAL(argv(7)), %VAL(argv(8)) , %VAL(argv(9)), &
%VAL(argv(10)), %VAL(argv(11)), %VAL(argv(12)), %VAL(argv(13)))
contains
SUBROUTINE init_E_diss_recomb_(mn, Te, me, Ti, mi, Ebr_number, Ebr_, br, &
simNumber, E_number, dE, distr_all, E)
%VAL(argv(5)), %VAL(argv(6)), %VAL(argv(7)), %VAL(argv(8)) , %VAL(argv(9)), &
%VAL(argv(10)), %VAL(argv(11)), %VAL(argv(12)), %VAL(argv(13)))
contains
SUBROUTINE init_E_diss_recomb_(mn, Te, me, Ti, mi, Ebr_number, Ebr_, br, &
simNumber, E_number, dE, distr_all, E)
Why do you have those %VALs? You never (well, almost never) need to use %VAL in Fortran-Fortran interaction. In the case at hand the compiler is complaining that you have pass-by-value in the caller but (default, implied) pass-by-reference in the callee.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Jugoslav Dujic
Why do you have those %VALs? You never (well, almost never) need to use %VAL in Fortran-Fortran interaction. In the case at hand the compiler is complaining that you have pass-by-value in the caller but (default, implied) pass-by-reference in the callee.
I use these %VALs because in the IDL manual following is written:
"A Fortran interface routine can be written to extract the addresses of the arguments
from the argv array and pass them to the actual routine which will compute the sum.
Passing the contents of each argv element by value has the same effect as converting
the parameter to a normal Fortran parameter.
This method uses the OpenVMS Extensions to Fortran, %LOC and %VAL."
The following code example is given in the IDL manual. They also need the %VALs.
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 hope this will answer your question, why I use %VALs. I would appreciate it, if the parsing of the IDL input variables could be done in another (easier) way. Because I dont know it, I had to do it in this way.
Hannes
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page