@Michael D. Black,
Can you provide a minimal working example of your code that models the
shared memory structure across the two processors in the WSJT-X
program?
The code snippet you show does not fully conform with the
interoperability with C facility provided by the Fortran standard nor
does it suggest any semblance of a good coding practice toward safe
and portable code. So why constrain yourself in any way with BIND(C)
attribute in the Fortran side of your code? You may even consider
unbinding the code as follows and let GCC front-ends take care of
details, not that I would ever recommend it, just wondering given your
concerns about rewriting the code with your code structure:
C:\temp>type f.f90
subroutine foo(i,c)
integer i
character(len=10) :: c
write(*,*) 'X',c,'Z'
write(*,*) "i = ", i
end
C:\temp>gfortran -c -Wall f.f90
C:\temp>type c.c
#include <string.h>
void foo_( int *, char * ); // Fortran procedure prototype
int main() {
char s[10];
int i = 42;
strcpy(s, "Hello");
foo_( &i, s);
return 0;
}
C:\temp>gfortran -c -Wall c.c
C:\temp>gfortran c.o f.o -o p.exe
C:\temp>p.exe
XHello Z
i = 42
Regards,
Vipul Parekh
|