% cat a.c
typedef struct X X;
struct X {
float f;
int d;
};
void
setf_(X *x)
{
x->f = 1.8;
}
void setd_(X*);
void
setd2_(X *x)
{
setd_(x);
}
% cat xmod.f90
module xmod
type X
real :: f
integer :: d
end type
end module
subroutine setd(tx)
use xmod
type(X) :: tx
tx%d = 18
end subroutine
% cat b.f90
program B
use xmod
type(X) :: tx
call setf(tx)
call setd2(tx)
print *, tx
end program
% gcc -c a.c; ifort -c xmod.f90; ifort -c b.f90; ifort -o ab a.o b.o xmod.o; ./ab
1.800000 18
Nenhum comentário:
Postar um comentário