Class IOModule

All Implemented Interfaces:
TypePlugin, Proxy

@Generated("org.javagi.JavaGI") public class IOModule extends TypeModule implements TypePlugin
Provides an interface and default functions for loading and unloading modules. This is used internally to make GIO extensible, but can also be used by others to implement module loading.
  • Constructor Details

    • IOModule

      public IOModule(MemorySegment address)
      Create a IOModule instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • IOModule

      public IOModule(String filename)
      Creates a new GIOModule that will load the specific shared library when in use.
      Parameters:
      filename - filename of the shared library module.
    • IOModule

      public IOModule()
      Create a new IOModule.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the IOModule class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected IOModule asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class TypeModule
      Returns:
      the instance as if it were its parent type
    • query

      public static String[] query()

      Optional API for GIO modules to implement.

      Should return a list of all the extension points that may be implemented in this module.

      This method will not be called in normal use, however it may be called when probing existing modules and recording which extension points that this model is used for. This means we won't have to load and initialize this module unless its needed.

      If this function is not implemented by the module the module will always be loaded, initialized and then unloaded on application startup so that it can register its extension points during init.

      Note that a module need not actually implement all the extension points that g_io_module_query() returns, since the exact list of extension may depend on runtime issues. However all extension points actually implemented must be returned by g_io_module_query() (if defined).

      When installing a module that implements g_io_module_query() you must run gio-querymodules in order to build the cache files required for lazy loading.

      Since 2.56, this function should be named g_io_<modulename>_query, where modulename is the plugin’s filename with the lib or libgio prefix and everything after the first dot removed, and with - replaced with _ throughout. For example, libgiognutls-helper.so becomes gnutls_helper. Using the new symbol names avoids name clashes when building modules statically. The old symbol names continue to be supported, but cannot be used for static builds.

      Returns:
      A null-terminated array of strings, listing the supported extension points of the module. The array must be suitable for freeing with g_strfreev().
      Since:
      2.24
    • loadModule

      public void loadModule()

      Required API for GIO modules to implement.

      This function is run after the module has been loaded into GIO, to initialize the module. Typically, this function will call g_io_extension_point_implement().

      Since 2.56, this function should be named g_io_<modulename>_load, where modulename is the plugin’s filename with the lib or libgio prefix and everything after the first dot removed, and with - replaced with _ throughout. For example, libgiognutls-helper.so becomes gnutls_helper. Using the new symbol names avoids name clashes when building modules statically. The old symbol names continue to be supported, but cannot be used for static builds.

    • unload

      public void unload()

      Required API for GIO modules to implement.

      This function is run when the module is being unloaded from GIO, to finalize the module.

      Since 2.56, this function should be named g_io_<modulename>_unload, where modulename is the plugin’s filename with the lib or libgio prefix and everything after the first dot removed, and with - replaced with _ throughout. For example, libgiognutls-helper.so becomes gnutls_helper. Using the new symbol names avoids name clashes when building modules statically. The old symbol names continue to be supported, but cannot be used for static builds.

      Overrides:
      unload in class TypeModule
    • builder

      public static IOModule.Builder<? extends IOModule.Builder> builder()
      A IOModule.Builder object constructs a IOModule with the specified properties. Use the various set...() methods to set properties, and finish construction with IOModule.Builder.build().
      Returns:
      the builder object