Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29010 Discussions

Error: The name of the module procedure conflicts with a name in the encompassing scoping unit.

Alexander_Kuznetsov
1,340 Views

Hi there,

I'm trying to compile the following module:

module

ReadWriteMonitor

! Interfaces

interface

GetValue

logical function GetInteger(iVal)

integer, intent(inout) :: iVal

end function

logical function GetDouble(dVal)

double precision, intent(inout) :: dVal

end function

end interface

private :: GetInteger

private

:: GetDouble

contains

logical

function GetInteger(iVal)

integer

, intent(inout) :: iVal

.....

GetInteger = .true.

return

end function

logical

function GetDouble(dVal)

double precision

, intent(inout) :: dVal

.........

GetDouble = .true.

return

end function

end module

I get the following error msgs:

Error: The name of the module procedure conflicts with a name in the encompassing scoping unit. [GETINTEGER]

Error: The name of the module procedure conflicts with a name in the encompassing scoping unit. [GETDOUBLE]

It looks like the compiler (IVF9.0 - I know it's old, but I need to stick to it for the time being...) doesn't like that the low-level functions GetInteger and GetDouble are defined in the same module. Indeed, when I take them out and remove the lines

private :: GetInteger

private

:: GetDouble

everything's fine. However, I want to hide the low-level functions and to expose only GetValue as public.

Any idea how I can do it?

Thanks,

Alexander

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,340 Views
Replace the interface for GetValue with this:

interface GetValue
module procedure GetInteger
module procedure GetDouble
end interface GetValue

The error is in redefining the interface to those module procedures.
0 Kudos
Alexander_Kuznetsov
1,340 Views

Great, it works!

Thanks a lot,

Alexander

0 Kudos
Reply