~ubuntu-branches/debian/jessie/glib2.0/jessie

« back to all changes in this revision

Viewing changes to docs/reference/glib/xml/windows.xml

Tags: upstream-2.16.1
Import upstream version 2.16.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
<link linkend="gchar">gchar</link>*              <link linkend="g-win32-get-package-installation-directory">g_win32_get_package_installation_directory</link>
26
26
                                                        (const <link linkend="gchar">gchar</link> *package,
27
27
                                                         const <link linkend="gchar">gchar</link> *dll_name);
 
28
<link linkend="gchar">gchar</link>*              <link linkend="g-win32-get-package-installation-directory-of-module">g_win32_get_package_installation_directory_of_module</link>
 
29
                                                        (<link linkend="gpointer">gpointer</link> hmodule);
28
30
<link linkend="gchar">gchar</link>*              <link linkend="g-win32-get-package-installation-subdirectory">g_win32_get_package_installation_subdirectory</link>
29
31
                                                        (const <link linkend="gchar">gchar</link> *package,
30
32
                                                         const <link linkend="gchar">gchar</link> *dll_name,
171
173
</simpara></listitem></varlistentry>
172
174
</variablelist></refsect2>
173
175
<refsect2>
 
176
<title><anchor id="g-win32-get-package-installation-directory-of-module" role="function" condition="since:2.16"/>g_win32_get_package_installation_directory_of_module ()</title>
 
177
<indexterm role="2.16"><primary>g_win32_get_package_installation_directory_of_module</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_win32_get_package_installation_directory_of_module
 
178
                                                        (<link linkend="gpointer">gpointer</link> hmodule);</programlisting>
 
179
<para>
 
180
This function tries to determine the installation directory of a
 
181
software package based on the location of a DLL of the software
 
182
package.
 
183
</para>
 
184
<para>
 
185
<parameter>hmodule</parameter> should be the handle of a loaded DLL or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. The
 
186
function looks up the directory that DLL was loaded from. If
 
187
<parameter>hmodule</parameter> is NULL, the directory the main executable of the current
 
188
process is looked up. If that directory's last component is "bin"
 
189
or "lib", its parent directory is returned, otherwise the directory
 
190
itself.
 
191
</para>
 
192
<para>
 
193
It thus makes sense to pass only the handle to a "public" DLL of a
 
194
software package to this function, as such DLLs typically are known
 
195
to be installed in a "bin" or occasionally "lib" subfolder of the
 
196
installation folder. DLLs that are of the dynamically loaded module
 
197
or plugin variety are often located in more private locations
 
198
deeper down in the tree, from which it is impossible for GLib to
 
199
deduce the root of the package installation.
 
200
</para>
 
201
<para>
 
202
The typical use case for this function is to have a <link linkend="DllMain"><function>DllMain()</function></link> that
 
203
saves the handle for the DLL. Then when code in the DLL needs to
 
204
construct names of files in the installation tree it calls this
 
205
function passing the DLL handle.</para>
 
206
<para>
 
207
 
 
208
</para><variablelist role="params">
 
209
<varlistentry><term><parameter>hmodule</parameter>&nbsp;:</term>
 
210
<listitem><simpara> The Win32 handle for a DLL loaded into the current process, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>
 
211
</simpara></listitem></varlistentry>
 
212
<varlistentry><term><emphasis>Returns</emphasis>&nbsp;:</term><listitem><simpara> a string containing the guessed installation directory for
 
213
the software package <parameter>hmodule</parameter> is from. The string is in the GLib
 
214
file name encoding, i.e. UTF-8. The return value should be freed
 
215
with <link linkend="g-free"><function>g_free()</function></link> when not needed any longer. If the function fails
 
216
<link linkend="NULL:CAPS"><literal>NULL</literal></link> is returned.
 
217
 
 
218
</simpara></listitem></varlistentry>
 
219
</variablelist><para role="since">Since  2.16
 
220
</para></refsect2>
 
221
<refsect2>
174
222
<title><anchor id="g-win32-get-package-installation-subdirectory" role="function"/>g_win32_get_package_installation_subdirectory ()</title>
175
223
<indexterm><primary>g_win32_get_package_installation_subdirectory</primary></indexterm><programlisting><link linkend="gchar">gchar</link>*              g_win32_get_package_installation_subdirectory
176
224
                                                        (const <link linkend="gchar">gchar</link> *package,