-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | GModule bindings
--   
--   Bindings for GModule, autogenerated by haskell-gi.
@package gi-gmodule
@version 2.0.6

-- | Build time configuration used during code generation.
module GI.GModule.Config

-- | Overrides used when generating these bindings.
overrides :: Text

-- | Modules in this package
modules :: [Text]

module GI.GModule.Constants

-- | No description available in the introspection data.
pattern MODULE_IMPL_WIN32 :: Int32

-- | No description available in the introspection data.
pattern MODULE_IMPL_NONE :: Int32

-- | No description available in the introspection data.
pattern MODULE_IMPL_DL :: Int32

-- | No description available in the introspection data.
pattern MODULE_IMPL_AR :: Int32

module GI.GModule.Enums

-- | Errors returned by g_module_open_full().
--   
--   Since: 2.70
data ModuleError

-- | there was an error loading or opening a module file
ModuleErrorFailed :: ModuleError

-- | a module returned an error from its g_module_check_init()
--   function
ModuleErrorCheckFailed :: ModuleError

-- | Catch-all for unknown values
AnotherModuleError :: Int -> ModuleError

-- | Catch exceptions of type ModuleError. This is a specialized
--   version of catchGErrorJustDomain.
catchModuleError :: IO a -> (ModuleError -> GErrorMessage -> IO a) -> IO a

-- | Handle exceptions of type ModuleError. This is a specialized
--   version of handleGErrorJustDomain.
handleModuleError :: (ModuleError -> GErrorMessage -> IO a) -> IO a -> IO a
instance GHC.Internal.Enum.Enum GI.GModule.Enums.ModuleError
instance GHC.Classes.Eq GI.GModule.Enums.ModuleError
instance Data.GI.Base.GError.GErrorClass GI.GModule.Enums.ModuleError
instance GHC.Classes.Ord GI.GModule.Enums.ModuleError
instance GHC.Internal.Show.Show GI.GModule.Enums.ModuleError

module GI.GModule.Flags

-- | Flags passed to g_module_open(). Note that these flags
--   are not supported on all platforms.
data ModuleFlags

-- | specifies that symbols are only resolved when needed. The default
--   action is to bind all symbols when the module is loaded.
ModuleFlagsLazy :: ModuleFlags

-- | specifies that symbols in the module should not be added to the global
--   name space. The default action on most platforms is to place symbols
--   in the module in the global name space, which may cause conflicts with
--   existing symbols.
ModuleFlagsLocal :: ModuleFlags

-- | mask for all flags.
ModuleFlagsMask :: ModuleFlags

-- | Catch-all for unknown values
AnotherModuleFlags :: Int -> ModuleFlags
instance GHC.Internal.Enum.Enum GI.GModule.Flags.ModuleFlags
instance GHC.Classes.Eq GI.GModule.Flags.ModuleFlags
instance Data.GI.Base.BasicTypes.IsGFlag GI.GModule.Flags.ModuleFlags
instance GHC.Classes.Ord GI.GModule.Flags.ModuleFlags
instance GHC.Internal.Show.Show GI.GModule.Flags.ModuleFlags

-- | The Module struct is an opaque data structure to represent a
--   dynamically-loaded module. It should only be accessed via the
--   following functions.
--   
--   To ensure correct lock ordering, these functions must not be called
--   from global constructors (for example, those using GCC’s
--   attribute((constructor)) attribute).
module GI.GModule.Structs.Module

-- | Memory-managed wrapper type.
newtype Module
Module :: ManagedPtr Module -> Module

-- | A portable way to build the filename of a module. The
--   platform-specific prefix and suffix are added to the filename, if
--   needed, and the result is added to the directory, using the correct
--   separator character.
--   
--   The directory should specify the directory where the module can be
--   found. It can be Nothing or an empty string to indicate that
--   the module is in a standard platform-specific directory, though this
--   is not recommended since the wrong module may be found.
--   
--   For example, calling moduleBuildPath on a Linux system with a
--   directory of /lib and a
--   moduleName of "mylibrary" will return
--   /lib/libmylibrary.so. On a Windows system, using
--   \Windows as the directory it will return
--   \Windows\mylibrary.dll.

-- | Deprecated: (Since version 2.76)Use g_module_open()
--   instead with moduleName as thebasename of the
--   file_name argument. See MODULE_SUFFIX for why.
moduleBuildPath :: (HasCallStack, MonadIO m) => Maybe Text -> Text -> m Text

-- | Closes a module.
moduleClose :: (HasCallStack, MonadIO m) => Module -> m Bool

-- | Gets a string describing the last module error.
moduleError :: (HasCallStack, MonadIO m) => m Text

-- | No description available in the introspection data.
moduleErrorQuark :: (HasCallStack, MonadIO m) => m Word32

-- | Ensures that a module will never be unloaded. Any future
--   moduleClose calls on the module will be ignored.
moduleMakeResident :: (HasCallStack, MonadIO m) => Module -> m ()

-- | Returns the filename that the module was opened with.
--   
--   If module refers to the application itself, "main" is
--   returned.
moduleName :: (HasCallStack, MonadIO m) => Module -> m Text

-- | Checks if modules are supported on the current platform.
moduleSupported :: (HasCallStack, MonadIO m) => m Bool

-- | Gets a symbol pointer from a module, such as one exported by
--   G_MODULE_EXPORT. Note that a valid symbol can be
--   Nothing.
moduleSymbol :: (HasCallStack, MonadIO m) => Module -> Text -> m (Bool, Ptr ())
instance Data.GI.Base.BasicTypes.BoxedPtr GI.GModule.Structs.Module.Module
instance GHC.Classes.Eq GI.GModule.Structs.Module.Module
instance Data.GI.Base.BasicTypes.ManagedPtrNewtype GI.GModule.Structs.Module.Module

module GI.GModule.Structs

module GI.GModule.Callbacks

-- | Type for the callback on the (unwrapped) C side.
type C_ModuleCheckInit = Ptr Module -> IO CString

-- | Specifies the type of the module initialization function. If a module
--   contains a function named g_module_check_init() it is
--   called automatically when the module is loaded. It is passed the
--   Module structure and should return Nothing on success or
--   a string describing the initialization error.
type ModuleCheckInit = Module -> IO Text

-- | Given a pointer to a foreign C function, wrap it into a function
--   callable from Haskell.
dynamic_ModuleCheckInit :: (HasCallStack, MonadIO m) => FunPtr C_ModuleCheckInit -> Module -> m Text

-- | Wrap the callback into a GClosure.
genClosure_ModuleCheckInit :: MonadIO m => ModuleCheckInit -> m (GClosure C_ModuleCheckInit)

-- | Generate a function pointer callable from C code, from a
--   C_ModuleCheckInit.
mk_ModuleCheckInit :: C_ModuleCheckInit -> IO (FunPtr C_ModuleCheckInit)

-- | A convenience synonym for Nothing :: Maybe
--   ModuleCheckInit.
noModuleCheckInit :: Maybe ModuleCheckInit

-- | Wrap a ModuleCheckInit into a C_ModuleCheckInit.
wrap_ModuleCheckInit :: Maybe (Ptr (FunPtr C_ModuleCheckInit)) -> ModuleCheckInit -> C_ModuleCheckInit

-- | Type for the callback on the (unwrapped) C side.
type C_ModuleUnload = Ptr Module -> IO ()

-- | Specifies the type of the module function called when it is unloaded.
--   If a module contains a function named
--   g_module_unload() it is called automatically when the
--   module is unloaded. It is passed the Module structure.
type ModuleUnload = Module -> IO ()

-- | Given a pointer to a foreign C function, wrap it into a function
--   callable from Haskell.
dynamic_ModuleUnload :: (HasCallStack, MonadIO m) => FunPtr C_ModuleUnload -> Module -> m ()

-- | Wrap the callback into a GClosure.
genClosure_ModuleUnload :: MonadIO m => ModuleUnload -> m (GClosure C_ModuleUnload)

-- | Generate a function pointer callable from C code, from a
--   C_ModuleUnload.
mk_ModuleUnload :: C_ModuleUnload -> IO (FunPtr C_ModuleUnload)

-- | A convenience synonym for Nothing :: Maybe
--   ModuleUnload.
noModuleUnload :: Maybe ModuleUnload

-- | Wrap a ModuleUnload into a C_ModuleUnload.
wrap_ModuleUnload :: Maybe (Ptr (FunPtr C_ModuleUnload)) -> ModuleUnload -> C_ModuleUnload

module GI.GModule
