File: c-module.html

package info (click to toggle)
aolserver4 4.5.1-18.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,008 kB
  • sloc: ansic: 45,126; tcl: 5,533; sh: 1,037; makefile: 380; pascal: 219; php: 13
file content (80 lines) | stat: -rw-r--r-- 2,469 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<html>
<head>
<title>AOLserver</title>
</head>
<body>

<h1>AOLserver C Module Development</h1>

<p>
$Header: /cvsroot/aolserver/aolserver.com/docs/devel/c/c-module.html,v 1.1 2002/03/07 19:15:35 kriston Exp $
<p>

<p>


AOLserver can be extended by loading one or more C modules
dynamically. You write these modules using your ordinary C code
development environment and compile them as shared library modules on
Unix as described below.

<p>

Each module must include an initialization routine that typically
calls one or more AOLserver C API functions for registering the
procedures within your module. The procedures within your module can
handle URLs (operation procedures) or do other special-purpose
functions. To register a C function in your module with the AOLserver,
pass a pointer to your function as an argument to one of the AOLserver
C API registration functions.

<p>

Module initialization functions can also set up any state required by
your functions. For example, the AOLserver database services module's
initialization routine creates a pool of database connections.

<p>

 Creating a Loadable Module

<p>

To create a dynamically loadable C module, compile your code and then
link the resulting object module into a shared library module on Unix.

<p>

Your C source code file must include the ns.h header file, which can
be found in the include subdirectory of the AOLserver home directory.
To compile and link your module.  It must have a Makefile that sources
$NSHOME/include/Makefile.module.  All build ruiles are kept in
include/Makefile.module and include/Makefile.global.  Makefile.module
includes Makefile.global so you only need to include one.  See the <a
href=c-module-example.adp>nsexample module</a> for an excellent
example.

<p>

 Using a Loadable Module

<p>

For each library you would like to have the AOLserver load at startup
time, add an entry in the server's Module section in the AOLserver
configuration file. The format of a load entry is a nickname for the
module, an equal sign, the filename of the module, and, optionally,
the name of an initialization routine in parentheses. For example:
 mymodule=mymodule.so(MyInit)

<p>

Module filenames typically end in .so on Unix platforms. If the module
filename is not an absolute path name, the AOLserver searches for the
module in the bin subdirectory of the AOLserver home directory. The
name of the initialization routine defaults to "Ns_ModuleInit".

<p>

</body>
</html>