| 1 |
! { dg-do compile } |
| 2 |
! Verify that initialization of c_ptr components works. |
| 3 |
module fgsl |
| 4 |
use, intrinsic :: iso_c_binding |
| 5 |
implicit none |
| 6 |
type, public :: fgsl_matrix |
| 7 |
private |
| 8 |
type(c_ptr) :: gsl_matrix = c_null_ptr |
| 9 |
end type fgsl_matrix |
| 10 |
type, public :: fgsl_multifit_fdfsolver |
| 11 |
private |
| 12 |
type(c_ptr) :: gsl_multifit_fdfsolver = c_null_ptr |
| 13 |
end type fgsl_multifit_fdfsolver |
| 14 |
interface |
| 15 |
function gsl_multifit_fdfsolver_jac(s) bind(c) |
| 16 |
import :: c_ptr |
| 17 |
type(c_ptr), value :: s |
| 18 |
type(c_ptr) :: gsl_multifit_fdfsolver_jac |
| 19 |
end function gsl_multifit_fdfsolver_jac |
| 20 |
end interface |
| 21 |
contains |
| 22 |
function fgsl_multifit_fdfsolver_jac(s) |
| 23 |
type(fgsl_multifit_fdfsolver), intent(in) :: s |
| 24 |
type(fgsl_matrix) :: fgsl_multifit_fdfsolver_jac |
| 25 |
fgsl_multifit_fdfsolver_jac%gsl_matrix = & |
| 26 |
gsl_multifit_fdfsolver_jac(s%gsl_multifit_fdfsolver) |
| 27 |
end function fgsl_multifit_fdfsolver_jac |
| 28 |
end module fgsl |
| 29 |
|
| 30 |
module m |
| 31 |
use, intrinsic :: iso_c_binding, only: c_ptr, c_null_ptr |
| 32 |
implicit none |
| 33 |
type t |
| 34 |
type(c_ptr) :: matrix = c_null_ptr |
| 35 |
end type t |
| 36 |
contains |
| 37 |
subroutine func(a) |
| 38 |
type(t), intent(out) :: a |
| 39 |
end subroutine func |
| 40 |
end module m |