Home > Archive > Fortran > November 2005 > [newbie] the problem of declaring a function in the interface
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
[newbie] the problem of declaring a function in the interface
|
|
| Jurang 2005-11-17, 9:57 pm |
| I might miss a basic point but I can't find what's the problem here.
within the interface, I declared the result variable "up_mv_mul" as
allocatable but why does it not recognize?
I appreciate
-----------------------------------------------------------------------------------------------------------------
Compile Error Message
"functions.f", 1514-199 (S) Array up_mv_mul is a deferred-shape array
but does not have the POINTER or ALLOCATABLE attributes
** def_fncs === End of Compilation 1 ===
** functions === End of Compilation 2 ===
1501-511 Compilation failed for file functions.f.
-------------------------------------------------------------------------------------------------------------
module def_fncs
interface
function up_mv_mul(A,x)
use const
implicit none
real(dp), dimension(:,:), intent(in) :: A
real(dp), dimension(:), intent(in) :: x
real(dp), dimension(:), allocatable :: up_mv_mul
end function up_mv_mul
end interface
end module def_fncs
module functions
use const
use cheb_grid
implicit none
contains
function up_mv_mul(A,x)
implicit none
real(dp), dimension(:,:), intent(in) :: A
real(dp), dimension(:), intent(in) :: x
real(dp), dimension(:), allocatable :: up_mv_mul
allocate(up_mv_mul(10))
end function up_mv_mul
end module functions
| |
| Dan Nagle 2005-11-17, 9:57 pm |
| Hello,
Jurang wrote:
> I might miss a basic point but I can't find what's the problem here.
>
> within the interface, I declared the result variable "up_mv_mul" as
> allocatable but why does it not recognize?
Because you're using a Fortran 95 compiler,
and allocatable function results are a Fortran 2003 feature.
> I appreciate
> -----------------------------------------------------------------------------------------------------------------
> Compile Error Message
>
> "functions.f", 1514-199 (S) Array up_mv_mul is a deferred-shape array
> but does not have the POINTER or ALLOCATABLE attributes
> ** def_fncs === End of Compilation 1 ===
> ** functions === End of Compilation 2 ===
> 1501-511 Compilation failed for file functions.f.
Is this xlf? I'm not sure I recognize it.
I know IBM is adding f03 features rather quickly,
but apparently, the release of xlf you have
doesn't support allocatable function results.
You might inquire with your compiler vendor
if a new release is planned which will support
allocatable function results.
> -------------------------------------------------------------------------------------------------------------
> module def_fncs
> interface
> function up_mv_mul(A,x)
> use const
> implicit none
> real(dp), dimension(:,:), intent(in) :: A
> real(dp), dimension(:), intent(in) :: x
> real(dp), dimension(:), allocatable :: up_mv_mul
> end function up_mv_mul
> end interface
> end module def_fncs
>
> module functions
> use const
> use cheb_grid
> implicit none
> contains
> function up_mv_mul(A,x)
> implicit none
> real(dp), dimension(:,:), intent(in) :: A
> real(dp), dimension(:), intent(in) :: x
> real(dp), dimension(:), allocatable :: up_mv_mul
> allocate(up_mv_mul(10))
> end function up_mv_mul
> end module functions
HTH
--
Cheers!
Dan Nagle
Purple Sage Computing Solutions, Inc.
| |
| Ian Bush 2005-11-21, 3:58 am |
| Dan Nagle wrote:
>
> Is this xlf? I'm not sure I recognize it.
> I know IBM is adding f03 features rather quickly,
> but apparently, the release of xlf you have
> doesn't support allocatable function results.
>
> You might inquire with your compiler vendor
> if a new release is planned which will support
> allocatable function results.
>
Looks very much like xlf. I'm pretty sure than the allocatable TR
stuff was in xlf 8, and given that 10 has just been realeased it suggests
that the OPs compiler is a bit old,
Ian
|
|
|
|
|