]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_so.html
Update/Create hyperlinks to new HTML document about DSO.
[apache] / docs / manual / mod / mod_so.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>Apache module mod_so</TITLE>
5 </HEAD>
6
7 <!-- Background white, links blue (unvisited), navy (visited), red (active) -->
8 <BODY
9  BGCOLOR="#FFFFFF"
10  TEXT="#000000"
11  LINK="#0000FF"
12  VLINK="#000080"
13  ALINK="#FF0000"
14 >
15 <!--#include virtual="header.html" -->
16 <H1 ALIGN="CENTER">Module mod_so</H1>
17
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.
25
26 <P>
27
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.
32
33 <H2>Summary</H2>
34
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.
38
39 <H2>Directives</H2>
40 <UL>
41 <LI><A HREF="#loadfile">LoadFile</A>
42 <LI><A HREF="#loadmodule">LoadModule</A>
43 </UL>
44 <HR>
45
46
47 <H2><A name="loadfile">LoadFile</A></H2>
48 <!--%plaintext &lt;?INDEX {\tt LoadFile} directive&gt; -->
49 <A
50  HREF="directive-dict.html#Syntax"
51  REL="Help"
52 ><STRONG>Syntax:</STRONG></A> LoadFile <EM>filename filename ...</EM><BR>
53 <A
54  HREF="directive-dict.html#Context"
55  REL="Help"
56 ><STRONG>Context:</STRONG></A> server config<BR>
57 <A
58  HREF="directive-dict.html#Status"
59  REL="Help"
60 ><STRONG>Status:</STRONG></A> Experimental<BR>
61 <A
62  HREF="directive-dict.html#Module"
63  REL="Help"
64 ><STRONG>Module:</STRONG></A> mod_so<P>
65
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>
71
72 <H2><A name="loadmodule">LoadModule</A></H2>
73 <!--%plaintext &lt;?INDEX {\tt LoadModule} directive&gt; -->
74 <A
75  HREF="directive-dict.html#Syntax"
76  REL="Help"
77 ><STRONG>Syntax:</STRONG></A> LoadModule <EM>module filename</EM><BR>
78 <A
79  HREF="directive-dict.html#Context"
80  REL="Help"
81 ><STRONG>Context:</STRONG></A> server config<BR>
82 <A
83  HREF="directive-dict.html#Status"
84  REL="Help"
85 ><STRONG>Status:</STRONG></A> Experimental<BR>
86 <A
87  HREF="directive-dict.html#Module"
88  REL="Help"
89 ><STRONG>Module:</STRONG></A> mod_so<P>
90
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):
95 <BLOCKQUOTE><CODE>
96 LoadModule status_module modules/mod_status.so
97 </CODE></BLOCKQUOTE>
98
99 <P>
100
101 Example (Windows):
102 <BLOCKQUOTE><CODE>
103 LoadModule status_module modules/ApacheModuleStatus.dll<BR>
104 </CODE></BLOCKQUOTE>
105
106 loads the named module from the modules subdirectory of the
107 ServerRoot.<P>
108
109 <HR>
110
111 <H2><A name="creating">Creating DLL Modules for Windows</A></H2>
112
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>
117
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>
124
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>
130
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
136    has:</P>
137 <PRE>
138     module foo_module;
139 </PRE>
140 <P>Replace the above with:</P>
141 <PRE>
142     module MODULE_VAR_EXPORT foo_module;
143 </PRE>
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>
148
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>
154
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
158    load it.</P>
159
160
161 <!--#include virtual="footer.html" -->
162 </BODY>
163 </HTML>
164