My objectif is to rename a fortran subroutine inside a module to be easily callable by C code (i.e. without the __<modulename>_MOD_ prefix), and using GCC-6.3.0. I cannot use bind(c,name='') even if it works great. I have read that I should use interface, but without any success. Here is the MWE:
module testmodule
interface
subroutine func02
!GCC$ ATTRIBUTES CDECL :: func01
end subroutine
end interface
contains
subroutine func01
print*,"func01"
end subroutine
end module
I compile using command gfortran -c test.f90 and then I check if the subroutine is correctly renamed using nm test.o, but there is no sign of func02.
Any help appreciated.
bind(c)? Whatever stops you using that may also stop you using any other suggestion, so it would be useful for you to clarify.bind(c)changes many thing starting with c-structure that are transmitted from C to Fortran very differently (with avoid *). I need this specific MWE to work. Thanks both for your interest in the question.