1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
4 <TITLE>Apache module mod_so</TITLE>
7 <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
15 <!--#include virtual="header.html" -->
16 <H1 ALIGN="CENTER">Module mod_so</H1>
18 This module is contained in the <CODE>mod_so.c</CODE> file. It is
19 compiled in by default on Windows and is not compiled in by default on
20 Unix. It provides for loading of executable code and modules into the
21 server at start-up or restart time. On Unix, the loaded code typically
22 comes from shared object files (usually with <SAMP>.so</SAMP>
23 extension), whilst on Windows this module loads <SAMP>DLL</SAMP>
24 files. This module is only available in Apache 1.3 and up.
28 In previous releases, the functionality of this module was provided
29 for Unix by mod_dld, and for Windows by mod_dll. On Windows, mod_dll
30 was used in beta release 1.3b1 through 1.3b5. mod_so combines these
31 two modules into a single module for all operating systems.
35 This is an experimental module. On selected operating systems it can be used
36 to load modules into Apache at runtime via the <A HREF="../dso.html">Dynamic
37 Shared Object</A> (DSO) mechanism, rather than requiring a recompilation.
41 <LI><A HREF="#loadfile">LoadFile</A>
42 <LI><A HREF="#loadmodule">LoadModule</A>
47 <H2><A name="loadfile">LoadFile</A></H2>
48 <!--%plaintext <?INDEX {\tt LoadFile} directive> -->
50 HREF="directive-dict.html#Syntax"
52 ><STRONG>Syntax:</STRONG></A> LoadFile <EM>filename filename ...</EM><BR>
54 HREF="directive-dict.html#Context"
56 ><STRONG>Context:</STRONG></A> server config<BR>
58 HREF="directive-dict.html#Status"
60 ><STRONG>Status:</STRONG></A> Experimental<BR>
62 HREF="directive-dict.html#Module"
64 ><STRONG>Module:</STRONG></A> mod_so<P>
66 The LoadFile directive links in the named object files or libraries
67 when the server is started or restarted; this is used to load
68 additional code which may be required for some module to
69 work. <EM>Filename</EM> is either and absolute path or relative to <A
70 HREF="core.html#serverroot">ServerRoot</A>.<P><HR>
72 <H2><A name="loadmodule">LoadModule</A></H2>
73 <!--%plaintext <?INDEX {\tt LoadModule} directive> -->
75 HREF="directive-dict.html#Syntax"
77 ><STRONG>Syntax:</STRONG></A> LoadModule <EM>module filename</EM><BR>
79 HREF="directive-dict.html#Context"
81 ><STRONG>Context:</STRONG></A> server config<BR>
83 HREF="directive-dict.html#Status"
85 ><STRONG>Status:</STRONG></A> Experimental<BR>
87 HREF="directive-dict.html#Module"
89 ><STRONG>Module:</STRONG></A> mod_so<P>
91 The LoadModule directive links in the object file or library <EM>filename</EM>
92 and adds the module structure named <EM>module</EM> to the list of active
93 modules. <EM>Module</EM> is the name of the external variable of type
94 <CODE>module</CODE> in the file. Example (Unix):
96 LoadModule status_module modules/mod_status.so
103 LoadModule status_module modules/ApacheModuleStatus.dll<BR>
106 loads the named module from the modules subdirectory of the
111 <H2><A name="creating">Creating DLL Modules for Windows</A></H2>
113 <P>The Apache module API is unchanged between the Unix and Windows
114 versions. Many modules will run on Windows with no or little change
115 from Unix, although others rely on aspects of the Unix architecture
116 which are not present in Windows, and will not work.</P>
118 <P>When a module does work, it can be added to the server in one of two
119 ways. As with Unix, it can be compiled into the server. Because Apache
120 for Windows does not have the <CODE>Configure</CODE> program of Apache
121 for Unix, the module's source file must be added to the ApacheCore
122 project file, and its symbols must be added to the
123 <CODE>os\win32\modules.c</CODE> file.</P>
125 <P>The second way is to compile the module as a DLL, a shared library
126 that can be loaded into the server at runtime, using the
127 <CODE><A HREF="#loadmodule">LoadModule</A></CODE>
128 directive. These module DLLs can be distributed and run on any Apache
129 for Windows installation, without recompilation of the server.</P>
131 <P>To create a module DLL, a small change is necessary to the module's
132 source file: The module record must be exported from the DLL (which
133 will be created later; see below). To do this, add the
134 <CODE>MODULE_VAR_EXPORT</CODE> (defined in the Apache header files) to
135 your module's module record definition. For example, if your module
140 <P>Replace the above with:</P>
142 module MODULE_VAR_EXPORT foo_module;
144 <P>Note that this will only be activated on Windows, so the module can
145 continue to be used, unchanged, with Unix if needed. Also, if you are
146 familiar with <CODE>.DEF</CODE> files, you can export the module
147 record with that method instead.</P>
149 <P>Now, create a DLL containing your module. You will need to link this
150 against the ApacheCore.lib export library that is created when the
151 ApacheCore.dll shared library is compiled. You may also have to change
152 the compiler settings to ensure that the Apache header files are
153 correctly located.</P>
155 <P>This should create a DLL version of your module. Now simply place it
156 in the <SAMP>modules</SAMP> directory of your server root, and use
157 the <CODE><A HREF="#loadmodule">LoadModule</A></CODE> directive to
161 <!--#include virtual="footer.html" -->