How to properly define interface for a generic procedure using external 'alien' procedures?
What I have now is the following:
module ExcelSupport
interface ExcelGetCell
module procedure GetCellInt
module procedure GetCellDouble
module procedure GetCellStr
end interface ExcelGetCell
contains
subroutine GetCellInt(row,col,value)
integer (SELECTED_INT_KIND(9)), intent(in) :: row, col
integer (SELECTED_INT_KIND(9)), intent(out) :: value
C_EXTERNAL ExcelGetCellInt 'ExcelGetCellInt' (val,val,ref)
call ExcelGetCellInt(row,col,value)
end subroutine GetCellInt
subroutine GetCellDouble(row,col,value)
integer (SELECTED_INT_KIND(9)), intent(in) :: row, col
real (SELECTED_REAL_KIND(15,307)), intent(out) :: value
C_EXTERNAL ExcelGetCellDouble 'ExcelGetCellDouble' (val,val,ref)
call ExcelGetCellDouble(row,col,value)
end subroutine GetCellDouble
subroutine GetCellStr(row,col,value)
integer (SELECTED_INT_KIND(9)), intent(in) :: row, col
character(len=*) , intent(out) :: value
C_EXTERNAL ExcelGetCellStr 'ExcelGetCellStr' (val,val,outstring)
call ExcelGetCellStr(row,col,value)
end subroutine GetCellStr
end module ExcelSupport
The problem is in the ExcelGetCellStr part. If I directly call C_EXTERNAL ExcelGetCellStr procedure, it works ok. As a part of generic procedure, I get garbage instead of a proper character string. Any ideas?