5 ! Contributed by Salvatore Filippone
7 ! Was before rejected as the different c_associated weren't recognized to
8 ! come from the same module.
13 type(c_ptr
), save :: test_context
= c_null_ptr
15 type, bind(c
) :: s_Cmat
16 type(c_ptr
) :: Mat
= c_null_ptr
21 function FtestCreate(context
) &
22 & bind(c
,name
="FtestCreate") result(res
)
24 type(c_ptr
) :: context
26 end function FtestCreate
30 function initFtest() result(res
)
33 if (c_associated(test_context
)) then
36 res
= FtestCreate(test_context
)
38 end function initFtest
43 integer, allocatable
:: ia(:)
44 end type base_sparse_mat
45 end module base_mat_mod
53 type, extends(base_sparse_mat
) :: extd_sparse_mat
54 type(s_Cmat
) :: deviceMat
55 end type extd_sparse_mat
57 end module extd_mat_mod
59 subroutine extd_foo(a
)
63 class(extd_sparse_mat
), intent(inout
) :: a
65 if (c_associated(a
%deviceMat
%Mat
)) then
66 write(*,*) 'C Associated'
69 end subroutine extd_foo