135 lines
4.2 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
2026-02-19 15:26:27 +00:00
import qualified HsBindgen.Runtime.LibC
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)) ("
2026-02-19 11:15:38 +00:00
, " struct T arg1"
2026-02-19 11:11:23 +00:00
, ")"
, "{"
, " return &hello_struct;"
, "}"
, "/* com_garnet_GarnetRs_get_hello_shape */"
, "__attribute__ ((const))"
, "void (*hs_bindgen_287ff3ac660f333b (void)) ("
2026-02-19 11:15:38 +00:00
, " struct Shape arg1"
2026-02-19 11:11:23 +00:00
, ")"
, "{"
, " return &hello_shape;"
, "}"
2026-02-19 15:26:27 +00:00
, "/* com_garnet_GarnetRs_get_add */"
, "__attribute__ ((const))"
, "int64_t (*hs_bindgen_bbabdbe61cd1eeb2 (void)) ("
, " int64_t arg1,"
, " int64_t arg2"
2026-02-19 15:26:27 +00:00
, ")"
, "{"
, " return &add;"
, "}"
]))
-- __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@
2026-02-19 11:15:38 +00:00
hs_bindgen_0f8c37ef19b17a6d :: IO (Ptr.FunPtr (T -> IO ()))
2026-02-19 11:11:23 +00:00
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@
-}
2026-02-19 11:15:38 +00:00
hello_struct :: Ptr.FunPtr (T -> IO ())
2026-02-19 11:11:23 +00:00
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@
2026-02-19 11:15:38 +00:00
hs_bindgen_287ff3ac660f333b :: IO (Ptr.FunPtr (Shape -> IO ()))
2026-02-19 11:11:23 +00:00
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@
-}
2026-02-19 11:15:38 +00:00
hello_shape :: Ptr.FunPtr (Shape -> IO ())
2026-02-19 11:11:23 +00:00
hello_shape =
GHC.IO.Unsafe.unsafePerformIO hs_bindgen_287ff3ac660f333b
2026-02-19 15:26:27 +00:00
-- __unique:__ @com_garnet_GarnetRs_get_add@
foreign import ccall unsafe "hs_bindgen_bbabdbe61cd1eeb2" hs_bindgen_bbabdbe61cd1eeb2_base ::
IO (Ptr.FunPtr Void)
-- __unique:__ @com_garnet_GarnetRs_get_add@
hs_bindgen_bbabdbe61cd1eeb2 :: IO (Ptr.FunPtr (HsBindgen.Runtime.LibC.Int64 -> HsBindgen.Runtime.LibC.Int64 -> IO HsBindgen.Runtime.LibC.Int64))
2026-02-19 15:26:27 +00:00
hs_bindgen_bbabdbe61cd1eeb2 =
HsBindgen.Runtime.Internal.HasFFIType.fromFFIType hs_bindgen_bbabdbe61cd1eeb2_base
{-# NOINLINE add #-}
{-| __C declaration:__ @add@
__defined at:__ @garnet_rs.h 38:9@
2026-02-19 15:26:27 +00:00
__exported by:__ @garnet_rs.h@
-}
add :: Ptr.FunPtr (HsBindgen.Runtime.LibC.Int64 -> HsBindgen.Runtime.LibC.Int64 -> IO HsBindgen.Runtime.LibC.Int64)
2026-02-19 15:26:27 +00:00
add =
GHC.IO.Unsafe.unsafePerformIO hs_bindgen_bbabdbe61cd1eeb2