-
+
&xoper;
&xindex;
+
+
Using C++ for Extensibility
+
+
+
+
+ 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).
+
+
+
+
+
+
+