mod_so.html revision 2de56243b49d1c39dbc467e3f9daab152c8691b8
549N/A<html xmlns="http://www.w3.org/TR/xhtml1/strict"><head><!--
553N/A XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
549N/A This file is generated from xml source: DO NOT EDIT
549N/A XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
549N/A --><title>mod_so- Apache HTTP Server</title><link href="/style/manual.css" type="text/css" rel="stylesheet"/></head><body><blockquote><div align="center"><img src="/images/sub.gif" alt="[APACHE DOCUMENTATION]"/><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>
549N/A This module provides for loading of executable code and
549N/A modules into the server at start-up or restart time.
549N/A</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>
549N/A
549N/A <p>On selected operating systems this module can be used to
549N/A load modules into Apache at runtime via the <a href="/dso.html">Dynamic Shared Object</a> (DSO) mechanism,
549N/A rather than requiring a recompilation.</p>
549N/A
549N/A <p>On Unix, the loaded code typically comes from shared object
549N/A files (usually with <code>.so</code> extension), on Windows
549N/A this may either the <code>.so</code> or <code>.dll</code>
549N/A extension. This module is only available in Apache 1.3 and
549N/A up.</p>
553N/A
553N/A <p>In previous releases, the functionality of this module was
553N/A provided for Unix by mod_dld, and for Windows by mod_dll. On
549N/A Windows, mod_dll was used in beta release 1.3b1 through 1.3b5.
549N/A mod_so combines these two modules into a single module for all
549N/A operating systems.</p>
549N/A <blockquote><table><tr><td bgcolor="#ffe5f5"><p align="center"><strong>Warning</strong></p>
549N/A <p>Apache 1.3 modules cannot be directly used
549N/A with Apache 2.0 - the module must be modified to dynamically
549N/A load or compile into Apache 2.0.</p>
549N/A </td></tr></table></blockquote>
549N/A<h2>Directives</h2><ul><li><a href="#loadfile">LoadFile</a></li><li><a href="#loadmodule">LoadModule</a></li></ul><h2>Creating Loadable Modules for Windows</h2>
549N/A
549N/A <blockquote><table><tr><td bgcolor="#e0e5f5"><p align="center"><strong>Note</strong></p>
549N/A <p>The module name format changed for Windows
549N/A with Apache 1.3.15 and 2.0 - the modules are now named as
549N/A mod_foo.so</p>
549N/A <p>While mod_so still loads modules with
549N/A ApacheModuleFoo.dll names, the new naming convention is
549N/A preferred; if you are converting your loadable module for 2.0,
549N/A please fix the name to this 2.0 convention.</p></td></tr></table></blockquote>
549N/A
549N/A <p>The Apache module API is unchanged between the Unix and
549N/A Windows versions. Many modules will run on Windows with no or
549N/A little change from Unix, although others rely on aspects of the
549N/A Unix architecture which are not present in Windows, and will
549N/A not work.</p>
549N/A
549N/A <p>When a module does work, it can be added to the server in
549N/A one of two ways. As with Unix, it can be compiled into the
549N/A server. Because Apache for Windows does not have the
549N/A <code>Configure</code> program of Apache for Unix, the module's
549N/A source file must be added to the ApacheCore project file, and
549N/A its symbols must be added to the
549N/A <code>os\win32\modules.c</code> file.</p>
549N/A
549N/A <p>The second way is to compile the module as a DLL, a shared
549N/A library that can be loaded into the server at runtime, using
549N/A the <code><code class="directive">LoadModule</code></code>
549N/A directive. These module DLLs can be distributed and run on any
549N/A Apache for Windows installation, without recompilation of the
549N/A server.</p>
549N/A
549N/A <p>To create a module DLL, a small change is necessary to the
549N/A module's source file: The module record must be exported from
549N/A the DLL (which will be created later; see below). To do this,
549N/A add the <code>AP_MODULE_DECLARE_DATA</code> (defined in the
549N/A Apache header files) to your module's module record definition.
549N/A For example, if your module has:</p>
549N/A
549N/A<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
549N/A module foo_module;
549N/A</code></td></tr></table></blockquote>
549N/A
549N/A <p>Replace the above with:</p>
549N/A<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
549N/A module AP_MODULE_DECLARE_DATA foo_module;
549N/A</code></td></tr></table></blockquote>
549N/A
549N/A <p>Note that this will only be activated on Windows, so the
549N/A module can continue to be used, unchanged, with Unix if needed.
549N/A Also, if you are familiar with <code>.DEF</code> files, you can
549N/A export the module record with that method instead.</p>
549N/A
549N/A <p>Now, create a DLL containing your module. You will need to
549N/A link this against the libhttpd.lib export library that is
549N/A created when the libhttpd.dll shared library is compiled. You
549N/A may also have to change the compiler settings to ensure that
549N/A the Apache header files are correctly located. You can find
549N/A this library in your server root's modules directory. It is
549N/A best to grab an existing module .dsp file from the tree to
549N/A assure the build environment is configured correctly, or
549N/A alternately compare the compiler and link options to your
549N/A .dsp.</p>
549N/A
549N/A <p>This should create a DLL version of your module. Now simply
549N/A place it in the <code>modules</code> directory of your server
549N/A root, and use the <code class="directive">LoadModule</code>
549N/A directive to load it.</p>
549N/A
549N/A<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>LoadFile <em>filename</em> [<em>filename</em>] ...</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>
549N/A
549N/A <p>The LoadFile directive links in the named object files or
549N/A libraries when the server is started or restarted; this is used
549N/A to load additional code which may be required for some module
549N/A to work. <em>Filename</em> is either an absolute path or
549N/A relative to <a href="core.html#serverroot">ServerRoot</a>.</p>
549N/A
549N/A <p>For example:</p>
549N/A
549N/A <blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>LoadFile libexex/libxmlparse.so</code></td></tr></table></blockquote>
549N/A
549N/A<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
549N/Aof active modules</td></tr><tr><td><a href="directive-dict.html#Syntax" class="help">Syntax:</a></td><td>LoadModule <em>module filename</em></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>
549N/A <p>The LoadModule directive links in the object file or library
549N/A <em>filename</em> and adds the module structure named
549N/A <em>module</em> to the list of active modules. <em>Module</em>
549N/A is the name of the external variable of type
549N/A <code>module</code> in the file, and is listed as the <a href="module-dict.html#ModuleIdentifier">Module Identifier</a>
in the module documentation. Example:</p>
<blockquote><table cellpadding="10"><tr><td bgcolor="#eeeeee"><code>
LoadModule status_module modules/mod_status.so
</code></td></tr></table></blockquote>
<p>loads the named module from the modules subdirectory of the
ServerRoot.</p>
<hr/></blockquote><h3 align="center">Apache HTTP Server Version 2.0</h3><a href="./"><img src="/images/index.gif" alt="Index"/></a><a href="../"><img src="/images/home.gif" alt="Home"/></a></body></html>