Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb67fbb6

Browse files
committed
Add documentation section "Using C++ for Extensibility".
Craig Ringer
1 parent309193b commitb67fbb6

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

‎doc/src/sgml/extend.sgml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/extend.sgml,v 1.38 2010/04/03 07:22:53 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/extend.sgml,v 1.39 2010/06/01 02:31:36 momjian Exp $ -->
22

33
<chapter id="extend">
44
<title>Extending <acronym>SQL</acronym></title>
@@ -273,4 +273,50 @@
273273
&xoper;
274274
&xindex;
275275

276+
<sect1 id="extend-how">
277+
<title>Using C++ for Extensibility</title>
278+
279+
<indexterm zone="extend-Cpp">
280+
<primary>C++</primary>
281+
</indexterm>
282+
283+
<para>
284+
It is possible to use a compiler in C++ mode to build
285+
<productname>PostgreSQL</productname> extensions; you must simply
286+
follow the standard methods for dynamically linking to C executables:
287+
288+
<itemizedlist>
289+
<listitem>
290+
<para>
291+
Use <literal>extern C</> linkage for all functions that must
292+
be accessible by <function>dlopen()</>. This is also necessary
293+
for any functions that might be passed as pointers between
294+
the backend and C++ code.
295+
</para>
296+
</listitem>
297+
<listitem>
298+
<para>
299+
Use <function>malloc()</> to allocate any memory that might be
300+
freed by the backend C code (don't pass <function>new()</>-allocated
301+
memory).
302+
</para>
303+
</listitem>
304+
<listitem>
305+
<para>
306+
Use <function>free()</> to free memory allocated by the backend
307+
C code (do not use <function>delete()</> for such cases).
308+
</para>
309+
</listitem>
310+
<listitem>
311+
<para>
312+
Prevent exceptions from propagating into the C code (use a
313+
catch-all block at the top level of all <literal>extern C</>
314+
functions).
315+
</para>
316+
</listitem>
317+
</itemizedlist>
318+
</para>
319+
320+
</sect1>
321+
276322
</chapter>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp