Calling Fortran From C: error passing argument 1

I have a C routine that calls a Fortran subroutine. I get the below error message. Can you give me examples on how to fix this?

error: implicit declaration of function ‘test_’ [-Werror=implicit-function-declaration]
test_(my_array,100L);

with the C my_array defined as:

char my_array[512];

The following subroutine call is made.

test_(my_array,100L);

The Fortran test_ subroutine is defined as:

SUBROUTINE TEST(MY_ARRAY)
CHARACTER*100 MY_ARRAY
C …
RETURN

Apparently you require all functions to be explicitly declared. Add a prototype like:

void test_(char *, long int);

You have not supplied a prototype in the C code for the function. Also, your subroutine on the Fortran side is not interoperable with C. It should look something like the following.

extern void test_(char* my_array, long int length);
...
char my_array[512];
...
test_(my_array,100L);
subroutine test(my_array, length) bind(C, name="test_")
  integer(c_long_int), intent(in) :: length
  character(len=1,kind=c_char) :: character(length)
  ...
end subroutine