mod_so.xml revision 70ce08850895485160d91d333b5a487ee2f80fbc
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<!-- $Revision$ -->
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Copyright 2002-2004 The Apache Software Foundation
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Licensed under the Apache License, Version 2.0 (the "License");
1e83c8de3aa48b316b28057d53995272baf1260cwrowe you may not use this file except in compliance with the License.
1e83c8de3aa48b316b28057d53995272baf1260cwrowe You may obtain a copy of the License at
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Unless required by applicable law or agreed to in writing, software
1e83c8de3aa48b316b28057d53995272baf1260cwrowe distributed under the License is distributed on an "AS IS" BASIS,
1e83c8de3aa48b316b28057d53995272baf1260cwrowe WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1e83c8de3aa48b316b28057d53995272baf1260cwrowe See the License for the specific language governing permissions and
1e83c8de3aa48b316b28057d53995272baf1260cwrowe limitations under the License.
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<description>Loading of executable code and
1e83c8de3aa48b316b28057d53995272baf1260cwrowemodules into the server at start-up or restart time</description>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<compatibility>This is a Base module (always included) on
1e83c8de3aa48b316b28057d53995272baf1260cwroweWindows</compatibility>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe <p>On selected operating systems this module can be used to
1e83c8de3aa48b316b28057d53995272baf1260cwrowe load modules into Apache at runtime via the <a
1e83c8de3aa48b316b28057d53995272baf1260cwrowe href="/dso.html">Dynamic Shared Object</a> (DSO) mechanism,
1e83c8de3aa48b316b28057d53995272baf1260cwrowe rather than requiring a recompilation.</p>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe <p>On Unix, the loaded code typically comes from shared object
1e83c8de3aa48b316b28057d53995272baf1260cwrowe files (usually with <code>.so</code> extension), on Windows
1e83c8de3aa48b316b28057d53995272baf1260cwrowe this may either the <code>.so</code> or <code>.dll</code>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe extension.</p>
56e85d89d42a6980f31b800266649efbed338da3wrowe <p>Apache 1.3 modules cannot be directly used
1e83c8de3aa48b316b28057d53995272baf1260cwrowe with Apache 2.0 - the module must be modified to dynamically
1e83c8de3aa48b316b28057d53995272baf1260cwrowe load or compile into Apache 2.0.</p>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe<section id="windows"><title>Creating Loadable Modules for Windows</title>
94b262d3639149df0b02642a9daa6db8bff58577wrowe <p>The module name format changed for Windows
94b262d3639149df0b02642a9daa6db8bff58577wrowe with Apache 1.3.15 and 2.0 - the modules are now named as
94b262d3639149df0b02642a9daa6db8bff58577wrowe <p>While mod_so still loads modules with
94b262d3639149df0b02642a9daa6db8bff58577wrowe ApacheModuleFoo.dll names, the new naming convention is
94b262d3639149df0b02642a9daa6db8bff58577wrowe preferred; if you are converting your loadable module for 2.0,
94b262d3639149df0b02642a9daa6db8bff58577wrowe please fix the name to this 2.0 convention.</p></note>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe <p>The Apache module API is unchanged between the Unix and
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Windows versions. Many modules will run on Windows with no or
1e83c8de3aa48b316b28057d53995272baf1260cwrowe little change from Unix, although others rely on aspects of the
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Unix architecture which are not present in Windows, and will
1e83c8de3aa48b316b28057d53995272baf1260cwrowe not work.</p>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe <p>When a module does work, it can be added to the server in
1e83c8de3aa48b316b28057d53995272baf1260cwrowe one of two ways. As with Unix, it can be compiled into the
1e83c8de3aa48b316b28057d53995272baf1260cwrowe server. Because Apache for Windows does not have the
1e83c8de3aa48b316b28057d53995272baf1260cwrowe <code>Configure</code> program of Apache for Unix, the module's
1e83c8de3aa48b316b28057d53995272baf1260cwrowe source file must be added to the ApacheCore project file, and
1e83c8de3aa48b316b28057d53995272baf1260cwrowe its symbols must be added to the
e1ad80c048e29e968221817698529d73098f07a4wrowe <p>The second way is to compile the module as a DLL, a shared
1e83c8de3aa48b316b28057d53995272baf1260cwrowe library that can be loaded into the server at runtime, using
1e83c8de3aa48b316b28057d53995272baf1260cwrowe directive. These module DLLs can be distributed and run on any
37ad54b8fd2611b7a4f2b269eec3d27ed784a25dwrowe Apache for Windows installation, without recompilation of the
1e83c8de3aa48b316b28057d53995272baf1260cwrowe server.</p>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe <p>To create a module DLL, a small change is necessary to the
1e83c8de3aa48b316b28057d53995272baf1260cwrowe module's source file: The module record must be exported from
94b262d3639149df0b02642a9daa6db8bff58577wrowe the DLL (which will be created later; see below). To do this,
94b262d3639149df0b02642a9daa6db8bff58577wrowe add the <code>AP_MODULE_DECLARE_DATA</code> (defined in the
94b262d3639149df0b02642a9daa6db8bff58577wrowe Apache header files) to your module's module record definition.
94b262d3639149df0b02642a9daa6db8bff58577wrowe For example, if your module has:</p>
94b262d3639149df0b02642a9daa6db8bff58577wrowe module foo_module;
1e83c8de3aa48b316b28057d53995272baf1260cwrowe module AP_MODULE_DECLARE_DATA foo_module;
1e83c8de3aa48b316b28057d53995272baf1260cwrowe <p>Note that this will only be activated on Windows, so the
1e83c8de3aa48b316b28057d53995272baf1260cwrowe module can continue to be used, unchanged, with Unix if needed.
1e83c8de3aa48b316b28057d53995272baf1260cwrowe Also, if you are familiar with <code>.DEF</code> files, you can
1e83c8de3aa48b316b28057d53995272baf1260cwrowe export the module record with that method instead.</p>
1e83c8de3aa48b316b28057d53995272baf1260cwrowe <p>Now, create a DLL containing your module. You will need to
1e83c8de3aa48b316b28057d53995272baf1260cwrowe link this against the libhttpd.lib export library that is
8c8173f49dd7122e10636b3d20ae841551bd0b43wrowe created when the libhttpd.dll shared library is compiled. You
1e83c8de3aa48b316b28057d53995272baf1260cwrowe may also have to change the compiler settings to ensure that
1e83c8de3aa48b316b28057d53995272baf1260cwrowe the Apache header files are correctly located. You can find
1e83c8de3aa48b316b28057d53995272baf1260cwrowe this library in your server root's modules directory. It is