Code Comments
Programming Forum and web based access to our favorite programming groups.Can anybody help me with this. I need to pass an allocatable matrix in a subroutine to the main program or to another subroutine. How can I do? I always get an error that I cannot do this. :\MSDEV\Mis proyectos\allocate\readmesh.f90(10): error FOR3435: symbol XC is a dummy argument - cannot be ALLOCATABLE detected between XC and , Error executing fl32.exe. allocate.exe - 1 error(s), 0 warning(s)
Post Follow-up to this messagejoegi.geo@yahoo.com (joel GUERRERO) wrote: >Can anybody help me with this. >I need to pass an allocatable matrix in a subroutine to the main >program or to another subroutine. How can I do? >I always get an error that I cannot do this. > >:\MSDEV\Mis proyectos\allocate\readmesh.f90(10): error FOR3435: symbol >XC is a dummy argument - cannot be ALLOCATABLE detected between XC and >, >Error executing fl32.exe. >allocate.exe - 1 error(s), 0 warning(s) ALLOCATABLE subroutine arguments (ASA) are not part of the Fortran 95 standa rd but were added in a Technical Report and will be part of Fortran 2003. Many Fortran 95 compilers already support ASA. Your compilation command is 'fl32.exe', which on my PC refers to the Compaq Visual Fortran compiler (I always use df.exe to invoke it). CVF 6.6 does support ASA, and the following program does compile and run. Maybe you are using an earlier version of CVF that does not support ASA or perhaps 'fl32.e xe' refers to Microsoft Fortran Powerstation, an old Fortran 90 compiler that I would not expect to support ASA. Which compiler are you using? module xmod contains subroutine foo(xx,n) real, allocatable :: xx(:) integer, intent(in) :: n integer :: i allocate (xx(n)) do i=1,n xx(i) = real(i) end do end subroutine foo end module xmod program xmain use xmod, only: foo real, allocatable :: yy(:) call foo(yy,5) print*,yy end program xmain ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==-- -- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 News groups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption = ---
Post Follow-up to this messagebeliavsky@aol.com wrote: | joegi.geo@yahoo.com (joel GUERRERO) wrote: || Can anybody help me with this. || I need to pass an allocatable matrix in a subroutine to the main || program or to another subroutine. How can I do? || I always get an error that I cannot do this. || || :\MSDEV\Mis proyectos\allocate\readmesh.f90(10): error FOR3435: symbol || XC is a dummy argument - cannot be ALLOCATABLE detected between XC and || , || Error executing fl32.exe. || allocate.exe - 1 error(s), 0 warning(s) | | Your compilation command is 'fl32.exe', which on my PC refers to the Compa q | Visual Fortran compiler (I always use df.exe to invoke it). Yes, but that's purely for compatibility with MS Fortran PowerStation4, whose compiler name was fl32.exe, and whose default installation directory is C:\MSDEV..., and that had FORxxxx nomenclature of error codes... I'd strongly suggest to Joel to ditch that buggy & unsupported compiler. (It does not support ALLOCATABLE dummies.) Joel, you do know that you need ALLOCATABLE attribute for a dummy argument only if you intend to do (de)allocation within the subroutine, don't you? Otherwise, (if you allocate it in the caller) you don't need it at all, as it will be treated as a normal static array within the subroutine. If you do need it, you can declare the matrix POINTER in both caller and callee and get by with that. -- Jugoslav ___________ www.geocities.com/jdujic Please reply to the newsgroup. You can find my real e-mail on my home page above.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.