Error #7977: The type of the function reference does not match the type of the function

Error #7977: The type of the function reference does not match the type of the function

Hi, I have a function that got the error #7977 when i compiled it. This code is to get the available physical memory during the program run and the compile platform is win32

function int4to8(src) result(des)
    use IFWINTY
    implicit none
    type(T_LARGE_INTEGERX) :: src
    integer(kind=8) :: des
    integer :: i
    integer :: tmp
    
    do i=0,31
        write(*,*) BTEST (src%LowPart,i)
        if(BTEST (src%LowPart,i) == .TRUE. ) then
            des = IBSET (des,i)
        end if
        if(BTEST (src%HighPart,i) ==.TRUE.) then
            des = IBSET (des,i+32)
        end if
    end do
end function int4to8
program GetSystemMemory
    use KERNEL32
    use IFWINTY
    
    type(T_MEMORYSTATUSEX) :: mymem
    logical :: switch
    type(T_LARGE_INTEGERX) :: xixi
    integer(kind=8) :: res
    
    MYMem%dwLength = sizeof(MYMem)
    switch = GlobalMemoryStatusEx(MYMem)
    xixi = MYMem%ullAvailPhys
    res = int4to8(xixi)
    write(*,*) "ullAvailPhys", res/1024

Thank you for your help!

2 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

The error message is exactly on target. You declared the result of int4to8 to be integer(8), but didn't declare it that way in the main program, so it was integer(4) there. If you had made the function a contained procedure or module procedure, this would not have been an issue.

Steve - Intel Developer Support

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!