Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
b67fbb6c
Commit
b67fbb6c
authored
Jun 01, 2010
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation section "Using C++ for Extensibility".
Craig Ringer
parent
309193bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
1 deletion
+47
-1
doc/src/sgml/extend.sgml
doc/src/sgml/extend.sgml
+47
-1
No files found.
doc/src/sgml/extend.sgml
View file @
b67fbb6c
<!-- $PostgreSQL: pgsql/doc/src/sgml/extend.sgml,v 1.3
8 2010/04/03 07:22:53 petere
Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/extend.sgml,v 1.3
9 2010/06/01 02:31:36 momjian
Exp $ -->
<chapter id="extend">
<title>Extending <acronym>SQL</acronym></title>
...
...
@@ -273,4 +273,50 @@
&xoper;
&xindex;
<sect1 id="extend-how">
<title>Using C++ for Extensibility</title>
<indexterm zone="extend-Cpp">
<primary>C++</primary>
</indexterm>
<para>
It is possible to use a compiler in C++ mode to build
<productname>PostgreSQL</productname> extensions; you must simply
follow the standard methods for dynamically linking to C executables:
<itemizedlist>
<listitem>
<para>
Use <literal>extern C</> linkage for all functions that must
be accessible by <function>dlopen()</>. This is also necessary
for any functions that might be passed as pointers between
the backend and C++ code.
</para>
</listitem>
<listitem>
<para>
Use <function>malloc()</> to allocate any memory that might be
freed by the backend C code (don't pass <function>new()</>-allocated
memory).
</para>
</listitem>
<listitem>
<para>
Use <function>free()</> to free memory allocated by the backend
C code (do not use <function>delete()</> for such cases).
</para>
</listitem>
<listitem>
<para>
Prevent exceptions from propagating into the C code (use a
catch-all block at the top level of all <literal>extern C</>
functions).
</para>
</listitem>
</itemizedlist>
</para>
</sect1>
</chapter>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment