1057N/A This module provides for loading of executable code and
1057N/A modules into the server at start-up or restart time.
1057N/A<
status>Base (Windows>; Optional (Unix)</
status>
1057N/A<
identifier>so_module</
identifier>
1057N/A<
compatibility>Available in Apache 1.3 and later.</
compatibility>
1057N/A <
p>On selected operating systems this module can be used to
1057N/A load modules into Apache at runtime via the <
a 660N/A rather than requiring a recompilation.</
p>
1109N/A <
p>On Unix, the loaded code typically comes from shared object
2506N/A files (usually with <
code>.so</
code> extension), on Windows
3404N/A this may either the <
code>.so</
code> or <
code>.dll</
code>
3404N/A extension. This module is only available in Apache 1.3 and
2437N/A <
p>In previous releases, the functionality of this module was
2437N/A provided for Unix by mod_dld, and for Windows by mod_dll. On
3356N/A Windows, mod_dll was used in beta release 1.3b1 through 1.3b5.
3356N/A mod_so combines these two modules into a single module for all
3404N/A <
note type="warning"><
title>Warning</
title>
2737N/A <
p>Apache 1.3 modules cannot be directly used
2737N/A with Apache 2.0 - the module must be modified to dynamically
2557N/A load or compile into Apache 2.0.</
p>
3404N/A<
section><
title>Creating Loadable Modules for Windows</
title>
3404N/A <
p>The module name format changed for Windows
3404N/A with Apache 1.3.15 and 2.0 - the modules are now named as
3404N/A <
p>While mod_so still loads modules with
2557N/A preferred; if you are converting your loadable module for 2.0,
3421N/A please fix the name to this 2.0 convention.</
p></
note>
2437N/A <
p>The Apache module API is unchanged between the Unix and
3421N/A Windows versions. Many modules will run on Windows with no or
3404N/A little change from Unix, although others rely on aspects of the
3404N/A Unix architecture which are not present in Windows, and will
2557N/A <
p>When a module does work, it can be added to the server in
2557N/A one of two ways. As with Unix, it can be compiled into the
2557N/A server. Because Apache for Windows does not have the
3421N/A <
code>Configure</
code> program of Apache for Unix, the module's
3404N/A source file must be added to the ApacheCore project file, and
2557N/A its symbols must be added to the
3404N/A <
p>The second way is to compile the module as a DLL, a shared
3404N/A library that can be loaded into the server at runtime, using
3404N/A the <
code><
directive>LoadModule</
directive></
code>
2437N/A directive. These module DLLs can be distributed and run on any
3404N/A Apache for Windows installation, without recompilation of the
3404N/A <
p>To create a module DLL, a small change is necessary to the
3404N/A module's source file: The module record must be exported from
3404N/A the DLL (which will be created later; see below). To do this,
3404N/A add the <
code>AP_MODULE_DECLARE_DATA</
code> (defined in the
3404N/A Apache header files) to your module's module record definition.
3404N/A For example, if your module has:</
p>
2437N/A <
p>Replace the above with:</
p>
2506N/A module AP_MODULE_DECLARE_DATA foo_module;
2095N/A <
p>Note that this will only be activated on Windows, so the
2095N/A module can continue to be used, unchanged, with Unix if needed.
3404N/A Also, if you are familiar with <
code>.DEF</
code> files, you can
3404N/A export the module record with that method instead.</
p>
3404N/A <
p>Now, create a DLL containing your module. You will need to
3404N/A may also have to change the compiler settings to ensure that
3404N/A the Apache header files are correctly located. You can find
3404N/A this library in your server root's modules directory. It is
3404N/A best to grab an existing module .dsp file from the tree to
3404N/A assure the build environment is configured correctly, or
3404N/A alternately compare the compiler and link options to your
3404N/A <
p>This should create a DLL version of your module. Now simply
3404N/A place it in the <
code>modules</
code> directory of your server
2557N/A root, and use the <
directive>LoadModule</
directive>
3404N/A<
description>Link in the named object file or library</
description>
2095N/A<
syntax>LoadFile <
em>filename</
em> [<
em>filename</
em>] ...</
syntax>
2095N/A<
context>server config</
context>
2506N/A <
p>The LoadFile directive links in the named object files or
3404N/A libraries when the server is started or restarted; this is used
3404N/A to load additional code which may be required for some module
3404N/A to work. <
em>Filename</
em> is either an absolute path or
3404N/A<
description>Links in the object file or library, and adds to the list
3404N/Aof active modules</
description>
2557N/A<
syntax>LoadModule <
em>module filename</
em></
syntax>
3404N/A<
context>server config</
context>
3404N/A <
p>The LoadModule directive links in the object file or library
3404N/A <
em>filename</
em> and adds the module structure named
2506N/A <
em>module</
em> to the list of active modules. <
em>Module</
em>
2506N/A is the name of the external variable of type
2506N/A <
code>module</
code> in the file, and is listed as the <
a 2557N/A in the module documentation. Example:</
p>
2557N/A <
p>loads the named module from the modules subdirectory of the