2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $Revision: 1.12 $ -->
7 Copyright 2002-2004 The Apache Software Foundation
9 Licensed under the Apache License, Version 2.0 (the "License");
10 you may not use this file except in compliance with the License.
11 You may obtain a copy of the License at
13 http://www.apache.org/licenses/LICENSE-2.0
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
22 <modulesynopsis metafile="mod_so.xml.meta">
25 <description>Loading of executable code and
26 modules into the server at start-up or restart time</description>
27 <status>Extension</status>
28 <sourcefile>mod_so.c</sourcefile>
29 <identifier>so_module</identifier>
30 <compatibility>This is a Base module (always included) on
31 Windows</compatibility>
35 <p>On selected operating systems this module can be used to
36 load modules into Apache at runtime via the <a
37 href="../dso.html">Dynamic Shared Object</a> (DSO) mechanism,
38 rather than requiring a recompilation.</p>
40 <p>On Unix, the loaded code typically comes from shared object
41 files (usually with <code>.so</code> extension), on Windows
42 this may either the <code>.so</code> or <code>.dll</code>
45 <note type="warning"><title>Warning</title>
46 <p>Apache 1.3 modules cannot be directly used
47 with Apache 2.0 - the module must be modified to dynamically
48 load or compile into Apache 2.0.</p>
52 <section id="windows"><title>Creating Loadable Modules for Windows</title>
54 <note><title>Note</title>
55 <p>The module name format changed for Windows
56 with Apache 1.3.15 and 2.0 - the modules are now named as
59 <p>While mod_so still loads modules with
60 ApacheModuleFoo.dll names, the new naming convention is
61 preferred; if you are converting your loadable module for 2.0,
62 please fix the name to this 2.0 convention.</p></note>
64 <p>The Apache module API is unchanged between the Unix and
65 Windows versions. Many modules will run on Windows with no or
66 little change from Unix, although others rely on aspects of the
67 Unix architecture which are not present in Windows, and will
70 <p>When a module does work, it can be added to the server in
71 one of two ways. As with Unix, it can be compiled into the
72 server. Because Apache for Windows does not have the
73 <code>Configure</code> program of Apache for Unix, the module's
74 source file must be added to the ApacheCore project file, and
75 its symbols must be added to the
76 <code>os\win32\modules.c</code> file.</p>
78 <p>The second way is to compile the module as a DLL, a shared
79 library that can be loaded into the server at runtime, using
80 the <code><directive>LoadModule</directive></code>
81 directive. These module DLLs can be distributed and run on any
82 Apache for Windows installation, without recompilation of the
85 <p>To create a module DLL, a small change is necessary to the
86 module's source file: The module record must be exported from
87 the DLL (which will be created later; see below). To do this,
88 add the <code>AP_MODULE_DECLARE_DATA</code> (defined in the
89 Apache header files) to your module's module record definition.
90 For example, if your module has:</p>
96 <p>Replace the above with:</p>
98 module AP_MODULE_DECLARE_DATA foo_module;
101 <p>Note that this will only be activated on Windows, so the
102 module can continue to be used, unchanged, with Unix if needed.
103 Also, if you are familiar with <code>.DEF</code> files, you can
104 export the module record with that method instead.</p>
106 <p>Now, create a DLL containing your module. You will need to
107 link this against the libhttpd.lib export library that is
108 created when the libhttpd.dll shared library is compiled. You
109 may also have to change the compiler settings to ensure that
110 the Apache header files are correctly located. You can find
111 this library in your server root's modules directory. It is
112 best to grab an existing module .dsp file from the tree to
113 assure the build environment is configured correctly, or
114 alternately compare the compiler and link options to your
117 <p>This should create a DLL version of your module. Now simply
118 place it in the <code>modules</code> directory of your server
119 root, and use the <directive>LoadModule</directive>
120 directive to load it.</p>
125 <name>LoadFile</name>
126 <description>Link in the named object file or library</description>
127 <syntax>LoadFile <em>filename</em> [<em>filename</em>] ...</syntax>
129 <context>server config</context>
134 <p>The LoadFile directive links in the named object files or
135 libraries when the server is started or restarted; this is used
136 to load additional code which may be required for some module
137 to work. <em>Filename</em> is either an absolute path or
138 relative to <a href="core.html#serverroot">ServerRoot</a>.</p>
142 <example>LoadFile libexec/libxmlparse.so</example>
148 <name>LoadModule</name>
149 <description>Links in the object file or library, and adds to the list
150 of active modules</description>
151 <syntax>LoadModule <em>module filename</em></syntax>
153 <context>server config</context>
157 <p>The LoadModule directive links in the object file or library
158 <em>filename</em> and adds the module structure named
159 <em>module</em> to the list of active modules. <em>Module</em>
160 is the name of the external variable of type
161 <code>module</code> in the file, and is listed as the <a
162 href="module-dict.html#ModuleIdentifier">Module Identifier</a>
163 in the module documentation. Example:</p>
166 LoadModule status_module modules/mod_status.so
169 <p>loads the named module from the modules subdirectory of the