diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml index 476af79bf4d..1a4dd6abfba 100644 --- a/doc/src/sgml/extend.sgml +++ b/doc/src/sgml/extend.sgml @@ -1,4 +1,4 @@ - + Extending <acronym>SQL</acronym> @@ -273,4 +273,50 @@ &xoper; &xindex; + + Using C++ for Extensibility + + + C++ + + + + It is possible to use a compiler in C++ mode to build + PostgreSQL extensions; you must simply + follow the standard methods for dynamically linking to C executables: + + + + + Use extern C linkage for all functions that must + be accessible by dlopen(). This is also necessary + for any functions that might be passed as pointers between + the backend and C++ code. + + + + + Use malloc() to allocate any memory that might be + freed by the backend C code (don't pass new()-allocated + memory). + + + + + Use free() to free memory allocated by the backend + C code (do not use delete() for such cases). + + + + + Prevent exceptions from propagating into the C code (use a + catch-all block at the top level of all extern C + functions). + + + + + + +