-- addDependentFile examples/golden/declarations/definitions.h -- #include -- signed int hs_bindgen_9cdc88a6d09442d6 ( -- double arg1 -- ) -- { -- return foo(arg1); -- } -- signed int hs_bindgen_07fd5b433f381094 ( -- double arg1 -- ) -- { -- return foo(arg1); -- } -- /* test_declarationsdefinitions_Example_get_foo */ -- __attribute__ ((const)) -- signed int (*hs_bindgen_8bb82cd68ce8efe4 (void)) ( -- double arg1 -- ) -- { -- return &foo; -- } -- /* test_declarationsdefinitions_Example_get_n */ -- __attribute__ ((const)) -- signed int *hs_bindgen_417f0d4479c97357 (void) -- { -- return &n; -- } {-| __C declaration:__ @struct X@ __defined at:__ @declarations\/definitions.h 23:8@ __exported by:__ @declarations\/definitions.h@ -} data X = X {x_n :: CInt {- ^ __C declaration:__ @n@ __defined at:__ @declarations\/definitions.h 23:16@ __exported by:__ @declarations\/definitions.h@ -}} {- ^ __C declaration:__ @struct X@ __defined at:__ @declarations\/definitions.h 23:8@ __exported by:__ @declarations\/definitions.h@ -} deriving stock (Eq, Show) instance StaticSize X where staticSizeOf = \_ -> 4 :: Int staticAlignment = \_ -> 4 :: Int instance ReadRaw X where readRaw = \ptr_0 -> pure X <*> readRaw (Proxy @"x_n") ptr_0 instance WriteRaw X where writeRaw = \ptr_0 -> \s_1 -> case s_1 of X x_n_2 -> writeRaw (Proxy @"x_n") ptr_0 x_n_2 deriving via (EquivStorable X) instance Storable X instance HasCField X "x_n" where type CFieldType X "x_n" = CInt offset# = \_ -> \_ -> 0 instance TyEq ty (CFieldType X "x_n") => HasField "x_n" (Ptr X) (Ptr ty) where getField = fromPtr (Proxy @"x_n") {-| __C declaration:__ @union Y@ __defined at:__ @declarations\/definitions.h 26:7@ __exported by:__ @declarations\/definitions.h@ -} newtype Y = Y {unwrapY :: ByteArray} {- ^ __C declaration:__ @union Y@ __defined at:__ @declarations\/definitions.h 26:7@ __exported by:__ @declarations\/definitions.h@ -} deriving via (SizedByteArray 4 4) instance StaticSize Y deriving via (SizedByteArray 4 4) instance ReadRaw Y deriving via (SizedByteArray 4 4) instance WriteRaw Y deriving via (EquivStorable Y) instance Storable Y {-| __See:__ 'set_y_m' __C declaration:__ @m@ __defined at:__ @declarations\/definitions.h 26:15@ __exported by:__ @declarations\/definitions.h@ -} get_y_m :: Y -> CInt {-| __See:__ 'set_y_m' __C declaration:__ @m@ __defined at:__ @declarations\/definitions.h 26:15@ __exported by:__ @declarations\/definitions.h@ -} get_y_m = getUnionPayload {-| __See:__ 'get_y_m' -} set_y_m :: CInt -> Y {-| __See:__ 'get_y_m' -} set_y_m = setUnionPayload {-| __See:__ 'set_y_o' __C declaration:__ @o@ __defined at:__ @declarations\/definitions.h 26:22@ __exported by:__ @declarations\/definitions.h@ -} get_y_o :: Y -> CInt {-| __See:__ 'set_y_o' __C declaration:__ @o@ __defined at:__ @declarations\/definitions.h 26:22@ __exported by:__ @declarations\/definitions.h@ -} get_y_o = getUnionPayload {-| __See:__ 'get_y_o' -} set_y_o :: CInt -> Y {-| __See:__ 'get_y_o' -} set_y_o = setUnionPayload instance HasCField Y "y_m" where type CFieldType Y "y_m" = CInt offset# = \_ -> \_ -> 0 instance TyEq ty (CFieldType Y "y_m") => HasField "y_m" (Ptr Y) (Ptr ty) where getField = fromPtr (Proxy @"y_m") instance HasCField Y "y_o" where type CFieldType Y "y_o" = CInt offset# = \_ -> \_ -> 0 instance TyEq ty (CFieldType Y "y_o") => HasField "y_o" (Ptr Y) (Ptr ty) where getField = fromPtr (Proxy @"y_o") -- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@ foreign import ccall safe "hs_bindgen_9cdc88a6d09442d6" hs_bindgen_9cdc88a6d09442d6_base :: Double -> IO Int32 -- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@ hs_bindgen_9cdc88a6d09442d6 :: CDouble -> IO CInt -- __unique:__ @test_declarationsdefinitions_Example_Safe_foo@ hs_bindgen_9cdc88a6d09442d6 = fromFFIType hs_bindgen_9cdc88a6d09442d6_base {-| __C declaration:__ @foo@ __defined at:__ @declarations\/definitions.h 13:5@ __exported by:__ @declarations\/definitions.h@ -} foo :: CDouble -> IO CInt {-| __C declaration:__ @foo@ __defined at:__ @declarations\/definitions.h 13:5@ __exported by:__ @declarations\/definitions.h@ -} foo = hs_bindgen_9cdc88a6d09442d6 -- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@ foreign import ccall unsafe "hs_bindgen_07fd5b433f381094" hs_bindgen_07fd5b433f381094_base :: Double -> IO Int32 -- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@ hs_bindgen_07fd5b433f381094 :: CDouble -> IO CInt -- __unique:__ @test_declarationsdefinitions_Example_Unsafe_foo@ hs_bindgen_07fd5b433f381094 = fromFFIType hs_bindgen_07fd5b433f381094_base {-| __C declaration:__ @foo@ __defined at:__ @declarations\/definitions.h 13:5@ __exported by:__ @declarations\/definitions.h@ -} foo :: CDouble -> IO CInt {-| __C declaration:__ @foo@ __defined at:__ @declarations\/definitions.h 13:5@ __exported by:__ @declarations\/definitions.h@ -} foo = hs_bindgen_07fd5b433f381094 -- __unique:__ @test_declarationsdefinitions_Example_get_foo@ foreign import ccall unsafe "hs_bindgen_8bb82cd68ce8efe4" hs_bindgen_8bb82cd68ce8efe4_base :: IO (FunPtr Void) -- __unique:__ @test_declarationsdefinitions_Example_get_foo@ hs_bindgen_8bb82cd68ce8efe4 :: IO (FunPtr (CDouble -> IO CInt)) -- __unique:__ @test_declarationsdefinitions_Example_get_foo@ hs_bindgen_8bb82cd68ce8efe4 = fromFFIType hs_bindgen_8bb82cd68ce8efe4_base {-# NOINLINE foo #-} {-| __C declaration:__ @foo@ __defined at:__ @declarations\/definitions.h 13:5@ __exported by:__ @declarations\/definitions.h@ -} foo :: FunPtr (CDouble -> IO CInt) {-| __C declaration:__ @foo@ __defined at:__ @declarations\/definitions.h 13:5@ __exported by:__ @declarations\/definitions.h@ -} foo = unsafePerformIO hs_bindgen_8bb82cd68ce8efe4 -- __unique:__ @test_declarationsdefinitions_Example_get_n@ foreign import ccall unsafe "hs_bindgen_417f0d4479c97357" hs_bindgen_417f0d4479c97357_base :: IO (Ptr Void) -- __unique:__ @test_declarationsdefinitions_Example_get_n@ hs_bindgen_417f0d4479c97357 :: IO (Ptr CInt) -- __unique:__ @test_declarationsdefinitions_Example_get_n@ hs_bindgen_417f0d4479c97357 = fromFFIType hs_bindgen_417f0d4479c97357_base {-# NOINLINE n #-} {-| __C declaration:__ @n@ __defined at:__ @declarations\/definitions.h 18:5@ __exported by:__ @declarations\/definitions.h@ -} n :: Ptr CInt {-| __C declaration:__ @n@ __defined at:__ @declarations\/definitions.h 18:5@ __exported by:__ @declarations\/definitions.h@ -} n = unsafePerformIO hs_bindgen_417f0d4479c97357