- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am somewhat new to Fortran and I just bought a subscription for ifort on Mac OS X. When I try compiling my code something goes wrong.
Here is my main program:
...
use func
use mult
...
print*, my_function(func,dfunc)
...
where both func and dfunc are defined in module "func":
...
function func(x)
real :: func
...
endfunction func
function dfunc
real, dimension(2) :: dfunc
...
endfunction dfunc
Also, "my_function" is defined in module "mult" likewise:
...
function my_function(func,dfunc)
real, external :: func
real, external :: dfunc
...
endfunction my_function
I get this error at compile-time:
"The shape matching rules of actual arguments and dummy arguments have been violated" referring to dfunc, which is an array of size 2.
What should I do to fix my problem?
Thanks!!
...
use func
use mult
...
print*, my_function(func,dfunc)
...
where both func and dfunc are defined in module "func":
...
function func(x)
real :: func
...
endfunction func
function dfunc
real, dimension(2) :: dfunc
...
endfunction dfunc
Also, "my_function" is defined in module "mult" likewise:
...
function my_function(func,dfunc)
real, external :: func
real, external :: dfunc
...
endfunction my_function
I get this error at compile-time:
"The shape matching rules of actual arguments and dummy arguments have been violated" referring to dfunc, which is an array of size 2.
What should I do to fix my problem?
Thanks!!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
my_func defines return type as scalar real for both external arguments. Whereas call to my_func passes two arguments each a rank 1 array of real dimensioned to 2. I have not tried the following to see if it is valid
function my_function(func,dfunc)
real, dimension(2), external :: func
real, dimension(2), external :: dfunc
You must resolve the shape matching rules.
Jim Dempsey
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