C 結構在 Fortran
bind 屬性也可以應用於派生型別:
geese.h
struct Goose {
int flock;
float buoyancy;
}
struct Goose goose_c;
geese.f90
use, intrinsic::iso_c_binding, only : c_int, c_float
type, bind(C) :: goose_t
integer(c_int) :: flock
real(c_float) :: buoyancy
end type goose_t
type(goose_t) :: goose_f
現在可以在 goose_c 和 goose_f 之間傳輸資料。可以使用 type(goose_t) 從 Fortran 呼叫帶有 Goose 型別引數的 C 例程。