@Beliavsky , the following compiles with no errors with gcc and icc.
extern float sum_mat(const int nr, const int nc, const float x[nc][nr]);
float sum_mat_c(const int nr, const int nc, const float x[nc][nr])
{
return sum_mat(nr, nc,x);
}
You should also change the nr and nc arguments in your Fortran function to pass by value ie.
function sum_mat(nr,nc,x) result(xsum) bind(c)
integer(kind=c_int) , value, intent(in) :: nr,nc
real (kind=c_float), intent(in) :: x(nr,nc)
real (kind=c_float) :: xsum
xsum = sum(x)
end function sum_mat