105 lines
3.3 KiB
Haskell
Raw Normal View History

{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_HADDOCK prune #-}
module GarnetRs.FunPtr where
import qualified Foreign.C as FC
import qualified GHC.IO.Unsafe
import qualified GHC.Ptr as Ptr
import qualified HsBindgen.Runtime.Internal.CAPI
import qualified HsBindgen.Runtime.Internal.HasFFIType
import qualified HsBindgen.Runtime.PtrConst
import Data.Void (Void)
2026-02-19 11:11:23 +00:00
import GarnetRs
import Prelude (IO)
$(HsBindgen.Runtime.Internal.CAPI.addCSource (HsBindgen.Runtime.Internal.CAPI.unlines
[ "#include <garnet_rs.h>"
, "/* com_garnet_GarnetRs_get_hello */"
, "__attribute__ ((const))"
, "void (*hs_bindgen_faf62265b53521d3 (void)) ("
, " char const *arg1"
, ")"
, "{"
, " return &hello;"
, "}"
2026-02-19 11:11:23 +00:00
, "/* com_garnet_GarnetRs_get_hello_struct */"
, "__attribute__ ((const))"
, "void (*hs_bindgen_0f8c37ef19b17a6d (void)) ("
, " struct T const *arg1"
, ")"
, "{"
, " return &hello_struct;"
, "}"
, "/* com_garnet_GarnetRs_get_hello_shape */"
, "__attribute__ ((const))"
, "void (*hs_bindgen_287ff3ac660f333b (void)) ("
, " struct Shape const *arg1"
, ")"
, "{"
, " return &hello_shape;"
, "}"
]))
-- __unique:__ @com_garnet_GarnetRs_get_hello@
foreign import ccall unsafe "hs_bindgen_faf62265b53521d3" hs_bindgen_faf62265b53521d3_base ::
IO (Ptr.FunPtr Void)
-- __unique:__ @com_garnet_GarnetRs_get_hello@
hs_bindgen_faf62265b53521d3 :: IO (Ptr.FunPtr ((HsBindgen.Runtime.PtrConst.PtrConst FC.CChar) -> IO ()))
hs_bindgen_faf62265b53521d3 =
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_faf62265b53521d3_base
{-# NOINLINE hello #-}
{-| __C declaration:__ @hello@
2026-02-19 11:11:23 +00:00
__defined at:__ @garnet_rs.h 32:6@
__exported by:__ @garnet_rs.h@
-}
hello :: Ptr.FunPtr ((HsBindgen.Runtime.PtrConst.PtrConst FC.CChar) -> IO ())
hello =
GHC.IO.Unsafe.unsafePerformIO hs_bindgen_faf62265b53521d3
2026-02-19 11:11:23 +00:00
-- __unique:__ @com_garnet_GarnetRs_get_hello_struct@
foreign import ccall unsafe "hs_bindgen_0f8c37ef19b17a6d" hs_bindgen_0f8c37ef19b17a6d_base ::
IO (Ptr.FunPtr Void)
-- __unique:__ @com_garnet_GarnetRs_get_hello_struct@
hs_bindgen_0f8c37ef19b17a6d :: IO (Ptr.FunPtr ((HsBindgen.Runtime.PtrConst.PtrConst T) -> IO ()))
hs_bindgen_0f8c37ef19b17a6d =
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_0f8c37ef19b17a6d_base
{-# NOINLINE hello_struct #-}
{-| __C declaration:__ @hello_struct@
__defined at:__ @garnet_rs.h 34:6@
__exported by:__ @garnet_rs.h@
-}
hello_struct :: Ptr.FunPtr ((HsBindgen.Runtime.PtrConst.PtrConst T) -> IO ())
hello_struct =
GHC.IO.Unsafe.unsafePerformIO hs_bindgen_0f8c37ef19b17a6d
-- __unique:__ @com_garnet_GarnetRs_get_hello_shape@
foreign import ccall unsafe "hs_bindgen_287ff3ac660f333b" hs_bindgen_287ff3ac660f333b_base ::
IO (Ptr.FunPtr Void)
-- __unique:__ @com_garnet_GarnetRs_get_hello_shape@
hs_bindgen_287ff3ac660f333b :: IO (Ptr.FunPtr ((HsBindgen.Runtime.PtrConst.PtrConst Shape) -> IO ()))
hs_bindgen_287ff3ac660f333b =
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_287ff3ac660f333b_base
{-# NOINLINE hello_shape #-}
{-| __C declaration:__ @hello_shape@
__defined at:__ @garnet_rs.h 36:6@
__exported by:__ @garnet_rs.h@
-}
hello_shape :: Ptr.FunPtr ((HsBindgen.Runtime.PtrConst.PtrConst Shape) -> IO ())
hello_shape =
GHC.IO.Unsafe.unsafePerformIO hs_bindgen_287ff3ac660f333b