11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.14 2001/05/19 09:01:10 petere Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.15 2001/10/26 19:58:12 tgl Exp $
33-->
44
55<sect2 id="dfunc">
66 <title id="dfunc-title">Compiling and Linking Dynamically-Loaded Functions</title>
77
88 <para>
99 Before you are able to use your
10- <productname>PostgreSQL</productname> extensionfunction written in
11- C theyneed to be compiled and linked in a special wayin order to
12- allow it to be dynamically loaded as needed by the server. To be
10+ <productname>PostgreSQL</productname> extensionfunctions written in
11+ C, theymust be compiled and linked in a special wayto produce a file
12+ that can be dynamically loaded by the server. To be
1313 precise, a <firstterm>shared library</firstterm> needs to be created.
1414 </para>
1515
@@ -31,7 +31,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/dfunc.sgml,v 1.14 2001/05/19 09:01:10 peter
3131 be created as <firstterm>position-independent code</firstterm>
3232 (<acronym>PIC</acronym>), which conceptually means that they can be
3333 placed at an arbitrary location in memory when they are loaded by the
34- executable. (Object files intended for executables are not compiled
34+ executable. (Object files intended for executables areusually not compiled
3535 that way.) The command to link a shared library contains special
3636 flags to distinguish it from linking an executable. --- At least
3737 this is the theory. On some systems the practice is much uglier.
@@ -263,16 +263,14 @@ gcc -shared -o foo.so foo.o
263263 The resulting shared library file can then be loaded into
264264 <productname>Postgres</productname>. When specifying the file name
265265 to the <command>CREATE FUNCTION</command> command, one must give it
266- the name of the shared library file (ending in
267- <filename>.so</filename>) rather than the intermediate object file.
268-
269- <note>
270- <para>
271- Actually, <productname>Postgres</productname> does not care what
272- you name the file as long as it is a shared library file.
273- </para>
274- </note>
266+ the name of the shared library file, not the intermediate object file.
267+ Note that the system's standard shared-library extension (usually
268+ <literal>.so</literal> or <literal>.sl</literal>) can be omitted from
269+ the <command>CREATE FUNCTION</command> command, and normally should
270+ be omitted for best portability.
271+ </para>
275272
273+ <para>
276274 Refer back to <xref linkend="xfunc-c-dynload"> about where the
277275 server expects to find the shared library files.
278276 </para>