]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_so.html
Bring the html transformations up-to-date.
[apache] / docs / manual / mod / mod_so.html
1 <html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
2 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3      This file is generated from xml source: DO NOT EDIT
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 --><title>mod_so - Apache HTTP Server</title><link href="../style/manual.css" type="text/css" rel="stylesheet"/></head><body><blockquote><div align="center"><img alt="[APACHE DOCUMENTATION]" src="../images/sub.gif"/><h3>Apache HTTP Server Version 2.0</h3></div><h1 align="center">Apache Module mod_so</h1><table cellspacing="1" cellpadding="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td valign="top"><span class="help">Description:</span></td><td><description>
6 This module provides for loading of executable code and
7 modules into the server at start-up or restart time.</description></td></tr><tr><td><a href="module-dict.html#Status" class="help">Status:</a></td><td>Base (Windows&gt;; Optional (Unix)</td></tr><tr><td><a href="module-dict.html#ModuleIdentifier" class="help">Module&nbsp;Identifier:</a></td><td>so_module</td></tr><tr><td align="left" valign="top"><a href="module-dict.html#Compatibility" class="help">Compatibility:</a></td><td><compatibility>Available in Apache 1.3 and later.</compatibility></td></tr></table></td></tr></table><h2>Summary</h2><summary>
8
9     <p>On selected operating systems this module can be used to
10     load modules into Apache at runtime via the <a href="../dso.html">Dynamic Shared Object</a> (DSO) mechanism,
11     rather than requiring a recompilation.</p>
12
13     <p>On Unix, the loaded code typically comes from shared object
14     files (usually with <samp>.so</samp> extension), on Windows
15     this may either the <samp>.so</samp> or <samp>.dll</samp>
16     extension. This module is only available in Apache 1.3 and
17     up.</p>
18
19     <p>In previous releases, the functionality of this module was
20     provided for Unix by mod_dld, and for Windows by mod_dll. On
21     Windows, mod_dll was used in beta release 1.3b1 through 1.3b5.
22     mod_so combines these two modules into a single module for all
23     operating systems.</p>
24
25     <p><strong>Warning: Apache 1.3 modules cannot be directly used
26     with Apache 2.0 - the module must be modified to dynamically
27     load or compile into Apache 2.0</strong>.</p>
28 </summary><h2>Directives</h2><ul><li><a href="#loadfile">LoadFile</a></li><li><a href="#loadmodule">LoadModule</a></li></ul><h2>Creating Loadable Modules
29 for Windows</h2>
30
31     <p><blockquote><table><tr><td bgcolor="#e0e5f5">Note: the module name format changed for Windows
32     with Apache 1.3.15 and 2.0 - the modules are now named as
33     mod_foo.so</td></tr></table></blockquote>. While mod_so still loads modules with
34     ApacheModuleFoo.dll names, the new naming convention is
35     preferred; if you are converting your loadable module for 2.0,
36     please fix the name to this 2.0 convention.</p>
37
38     <p>The Apache module API is unchanged between the Unix and
39     Windows versions. Many modules will run on Windows with no or
40     little change from Unix, although others rely on aspects of the
41     Unix architecture which are not present in Windows, and will
42     not work.</p>
43
44     <p>When a module does work, it can be added to the server in
45     one of two ways. As with Unix, it can be compiled into the
46     server. Because Apache for Windows does not have the
47     <code>Configure</code> program of Apache for Unix, the module's
48     source file must be added to the ApacheCore project file, and
49     its symbols must be added to the
50     <code>os\win32\modules.c</code> file.</p>
51
52     <p>The second way is to compile the module as a DLL, a shared
53     library that can be loaded into the server at runtime, using
54     the <code><code class="directive">LoadModule</code></code>
55     directive. These module DLLs can be distributed and run on any
56     Apache for Windows installation, without recompilation of the
57     server.</p>
58
59     <p>To create a module DLL, a small change is necessary to the
60     module's source file: The module record must be exported from
61     the DLL (which will be created later; see below). To do this,
62     add the <code>AP_MODULE_DECLARE_DATA</code> (defined in the
63     Apache header files) to your module's module record definition.
64     For example, if your module has:</p>
65
66 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
67     module foo_module;
68 </code></td></tr></table></blockquote>
69
70     <p>Replace the above with:</p>
71 <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
72     module AP_MODULE_DECLARE_DATA foo_module;
73 </code></td></tr></table></blockquote>
74
75     <p>Note that this will only be activated on Windows, so the
76     module can continue to be used, unchanged, with Unix if needed.
77     Also, if you are familiar with <code>.DEF</code> files, you can
78     export the module record with that method instead.</p>
79
80     <p>Now, create a DLL containing your module. You will need to
81     link this against the libhttpd.lib export library that is
82     created when the libhttpd.dll shared library is compiled. You
83     may also have to change the compiler settings to ensure that
84     the Apache header files are correctly located. You can find
85     this library in your server root's modules directory. It is
86     best to grab an existing module .dsp file from the tree to
87     assure the build environment is configured correctly, or
88     alternately compare the compiler and link options to your
89     .dsp.</p>
90
91     <p>This should create a DLL version of your module. Now simply
92     place it in the <samp>modules</samp> directory of your server
93     root, and use the <code class="directive">LoadModule</code>
94     directive to load it.</p>
95
96 <hr/><h2><a name="LoadFile">LoadFile</a> <a name="loadfile">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Link in the named object file or library</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td><syntax>LoadFile <em>filename</em> [<em>filename</em>] ...</syntax></td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>none</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base (Windows&gt;; Optional (Unix)</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_so</td></tr></table></td></tr></table><usage>
97
98     <p>The LoadFile directive links in the named object files or
99     libraries when the server is started or restarted; this is used
100     to load additional code which may be required for some module
101     to work. <em>Filename</em> is either an absolute path or
102     relative to <a href="core.html#serverroot">ServerRoot</a>.</p>
103 </usage><hr/><h2><a name="LoadModule">LoadModule</a> <a name="loadmodule">Directive</a></h2><table cellpadding="1" cellspacing="0" border="0" bgcolor="#cccccc"><tr><td><table bgcolor="#ffffff"><tr><td><strong>Description: </strong></td><td>Links in the object file or library, and adds to the list
104 of active modules</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td><syntax>LoadModule <em>module filename</em></syntax></td></tr><tr><td><a href="directive-dict.html#Default" class="help">Default:</a></td><td><code>none</code></td></tr><tr><td><a href="directive-dict.html#Context" class="help">Context:</a></td><td>server config</td></tr><tr><td><a href="directive-dict.html#Status" class="help">Status:</a></td><td>Base (Windows&gt;; Optional (Unix)</td></tr><tr><td><a href="directive-dict.html#Module" class="help">Module:</a></td><td>mod_so</td></tr></table></td></tr></table><usage>
105     <p>The LoadModule directive links in the object file or library
106     <em>filename</em> and adds the module structure named
107     <em>module</em> to the list of active modules. <em>Module</em>
108     is the name of the external variable of type
109     <code>module</code> in the file, and is listed as the <a href="module-dict.html#ModuleIdentifier">Module Identifier</a>
110     in the module documentation. Example:</p>
111
112     <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
113       LoadModule status_module modules/mod_status.so
114     </code></td></tr></table></blockquote>
115
116     <p>loads the named module from the modules subdirectory of the
117     ServerRoot.</p>
118 </usage><hr/><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img alt="Index" src="../images/index.gif"/></a><a href="../"><img alt="Home" src="../images/home.gif"/></a></blockquote></body></html>