1
1
<chapter id="dfunc">
2
2
<title id="dfunc-title">Linking Dynamically-Loaded Functions</title>
3
3
4
+ <para>
5
+
4
6
<!--
5
7
.SH "Compiling Dynamically-Loaded C Functions"
6
8
.PP
@@ -100,19 +102,23 @@ You should look at the Postgres User's Manual for an explanation of this
100
102
procedure.
101
103
-->
102
104
103
- <para>
104
105
After you have created and registered a user-defined
105
- function, your work is essentially done. <productname>Postgres</productname>,
106
- however, must load the object code (e.g., a <filename>.o</filename> file, or
106
+ function, your work is essentially done.
107
+ <productname>Postgres</productname>,
108
+ however, must load the object code
109
+ (e.g., a <literal>.o</literal> file, or
107
110
a shared library) that implements your function. As
108
- previously mentioned, <productname>Postgres</productname> loads your code at
111
+ previously mentioned, <productname>Postgres</productname>
112
+ loads your code at
109
113
runtime, as required. In order to allow your code to be
110
114
dynamically loaded, you may have to compile and
111
115
link-edit it in a special way. This section briefly
112
116
describes how to perform the compilation and
113
117
link-editing required before you can load your user-defined
114
- functions into a running <productname>Postgres</productname> server. Note that
118
+ functions into a running <productname>Postgres</productname> server.
119
+ Note that
115
120
this process has changed as of Version 4.2.
121
+ </para>
116
122
117
123
<!--
118
124
<tip>
@@ -123,15 +129,17 @@ procedure.
123
129
and alignment of executable instructions within memory, etc.
124
130
on the part of the person writing the dynamic loader. Such
125
131
loaders tended to be slow and buggy. As of Version 4.2, the
126
- <productname>Postgres</productname> dynamic loading mechanism has been rewritten to use
132
+ <productname>Postgres</productname> dynamic loading mechanism
133
+ has been rewritten to use
127
134
the dynamic loading mechanism provided by the operating
128
135
system. This approach is generally faster, more reliable and
129
136
more portable than our previous dynamic loading mechanism.
130
137
The reason for this is that nearly all modern versions of
131
138
Unix use a dynamic loading mechanism to implement shared
132
139
libraries and must therefore provide a fast and reliable
133
140
mechanism. On the other hand, the object file must be
134
- postprocessed a bit before it can be loaded into <productname>Postgres</productname>. We
141
+ postprocessed a bit before it can be loaded into
142
+ <productname>Postgres</productname>. We
135
143
hope that the large increase in speed and reliability will
136
144
make up for the slight decrease in convenience.
137
145
</para>