/usr/include/d/gtkd-3/glib/Module.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | /*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module glib.Module;
private import glib.Str;
private import glib.c.functions;
public import glib.c.types;
public import gtkc.glibtypes;
/**
* The #GModule struct is an opaque data structure to represent a
* [dynamically-loaded module][glib-Dynamic-Loading-of-Modules].
* It should only be accessed via the following functions.
*/
public class Module
{
/** the main Gtk struct */
protected GModule* gModule;
protected bool ownedRef;
/** Get the main Gtk struct */
public GModule* getModuleStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gModule;
}
/** the main Gtk struct as a void* */
protected void* getStruct()
{
return cast(void*)gModule;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GModule* gModule, bool ownedRef = false)
{
this.gModule = gModule;
this.ownedRef = ownedRef;
}
/**
* Closes a module.
*
* Returns: %TRUE on success
*/
public bool close()
{
return g_module_close(gModule) != 0;
}
/**
* Ensures that a module will never be unloaded.
* Any future g_module_close() calls on the module will be ignored.
*/
public void makeResident()
{
g_module_make_resident(gModule);
}
/**
* Returns the filename that the module was opened with.
*
* If @module refers to the application itself, "main" is returned.
*
* Returns: the filename of the module
*/
public string name()
{
return Str.toString(g_module_name(gModule));
}
/**
* Gets a symbol pointer from a module, such as one exported
* by #G_MODULE_EXPORT. Note that a valid symbol can be %NULL.
*
* Params:
* symbolName = the name of the symbol to find
* symbol = returns the pointer to the symbol value
*
* Returns: %TRUE on success
*/
public bool symbol(string symbolName, void** symbol)
{
return g_module_symbol(gModule, Str.toStringz(symbolName), symbol) != 0;
}
/**
* 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 %NULL 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 g_module_build_path() on a Linux system with a
* @directory of `/lib` and a @module_name of "mylibrary" will return
* `/lib/libmylibrary.so`. On a Windows system, using `\Windows` as the
* directory it will return `\Windows\mylibrary.dll`.
*
* Params:
* directory = the directory where the module is. This can be
* %NULL or the empty string to indicate that the standard platform-specific
* directories will be used, though that is not recommended
* moduleName = the name of the module
*
* Returns: the complete path of the module, including the standard library
* prefix and suffix. This should be freed when no longer needed
*/
public static string buildPath(string directory, string moduleName)
{
auto retStr = g_module_build_path(Str.toStringz(directory), Str.toStringz(moduleName));
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Gets a string describing the last module error.
*
* Returns: a string describing the last module error
*/
public static string error()
{
return Str.toString(g_module_error());
}
/**
* Opens a module. If the module has already been opened,
* its reference count is incremented.
*
* First of all g_module_open() tries to open @file_name as a module.
* If that fails and @file_name has the ".la"-suffix (and is a libtool
* archive) it tries to open the corresponding module. If that fails
* and it doesn't have the proper module suffix for the platform
* (#G_MODULE_SUFFIX), this suffix will be appended and the corresponding
* module will be opended. If that fails and @file_name doesn't have the
* ".la"-suffix, this suffix is appended and g_module_open() tries to open
* the corresponding module. If eventually that fails as well, %NULL is
* returned.
*
* Params:
* fileName = the name of the file containing the module, or %NULL
* to obtain a #GModule representing the main program itself
* flags = the flags used for opening the module. This can be the
* logical OR of any of the #GModuleFlags
*
* Returns: a #GModule on success, or %NULL on failure
*/
public static Module open(string fileName, GModuleFlags flags)
{
auto p = g_module_open(Str.toStringz(fileName), flags);
if(p is null)
{
return null;
}
return new Module(cast(GModule*) p);
}
/**
* Checks if modules are supported on the current platform.
*
* Returns: %TRUE if modules are supported
*/
public static bool supported()
{
return g_module_supported() != 0;
}
}
|