aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-11-14 22:58:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-11-14 22:58:51 +0000
commit07c179a82b39ffbc172175382717706d90c714cd (patch)
treee9e89e47d3ab64c2fcb07e3e12b034cf1ef4df37
parent772eedb6bb5414a53b40e24d76fb9c3b8649d708 (diff)
downloadpostgresql-07c179a82b39ffbc172175382717706d90c714cd.tar.gz
postgresql-07c179a82b39ffbc172175382717706d90c714cd.zip
Document a gotcha that happens on Windows when using libpq's new event
procedure support: it's possible to get confused because exported procedures have two different addresses. Per Andrew Chernow.
-rw-r--r--doc/src/sgml/libpq.sgml15
1 files changed, 14 insertions, 1 deletions
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 0b220ab514b..d7b4d2393a1 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.269 2008/11/13 09:45:24 mha Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.270 2008/11/14 22:58:51 tgl Exp $ -->
<chapter id="libpq">
<title><application>libpq</application> - C Library</title>
@@ -5255,6 +5255,19 @@ int eventproc(PGEventId evtId, void *evtInfo, void *passThrough)
<structname>PGconn</>. This is because the address of the procedure
is used as a lookup key to identify the associated instance data.
</para>
+
+ <caution>
+ <para>
+ On Windows, functions can have two different addresses: one visible
+ from outside a DLL and another visible from inside the DLL. One
+ should be careful that only one of these addresses is used with
+ <application>libpq</>'s event-procedure functions, else confusion will
+ result. The simplest rule for writing code that will work is to
+ ensure that event procedures are declared <literal>static</>. If the
+ procedure's address must be available outside its own source file,
+ expose a separate function to return the address.
+ </para>
+ </caution>
</listitem>
</varlistentry>
</variablelist>