The recent v0.3.0 introduced a behavior change that caused compilation errors in our project.
To illustrate the issue, let me use a very simple Fortran module defining a module variable and a subroutine used to print a number:
module global
implicit none
integer :: number
contains
subroutine print_number(number)
integer, intent(in) :: number
print*, number
end subroutine print_number
end module global
The special thing here is that the module variable and subroutine argument have the same name, which is totally OK on the Fortran side because they have different scopes.
Now comes the difference. When generating the f90wrap_ interfaces, versions < 0.3.0 would use the only clause to only bring in the function being interfaced:
! Module global_ defined in file global.f90
subroutine f90wrap_global__print_number(number)
use global, only: print_number
implicit none
integer, intent(in) :: number
call print_number(number=number)
end subroutine f90wrap_global__print_number
[...]
The new 0.3.0 version doesn't use the only clause for some reason leading to the following:
! Module global_ defined in file global.f90
subroutine f90wrap_global__print_num(num)
use global
implicit none
integer, intent(in) :: num
call print_num(num=num)
end subroutine f90wrap_global__print_num
Because of the unrestricted use, we now have two variables with the same name in the same scope leading to a compilation error:
7 | integer, intent(in) :: number
| 1
Error: Name ‘number’ at (1) is an ambiguous reference to ‘number’ from current program unit
f90wrap_global_3.0.f90:3:46:
3 | subroutine f90wrap_global__print_number(number)
| 1
Error: Symbol ‘number’ at (1) has no IMPLICIT type
I am currently looking into the f90wrap code to try debugging this problem. I already open the issue hoping that someone already has an answer :)
The recent
v0.3.0introduced a behavior change that caused compilation errors in our project.To illustrate the issue, let me use a very simple Fortran module defining a module variable and a subroutine used to print a number:
The special thing here is that the module variable and subroutine argument have the same name, which is totally OK on the Fortran side because they have different scopes.
Now comes the difference. When generating the
f90wrap_interfaces, versions < 0.3.0 would use theonlyclause to only bring in the function being interfaced:The new 0.3.0 version doesn't use the
onlyclause for some reason leading to the following:Because of the unrestricted
use, we now have two variables with the same name in the same scope leading to a compilation error:I am currently looking into the f90wrap code to try debugging this problem. I already open the issue hoping that someone already has an answer :)