Author: wyoung
Date: Sat Oct 27 09:46:54 2007
New Revision: 1811

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1811&view=rev
Log:
Added a section to the SSQLS chapter in the userman describing
MYSQLPP_SSQLS_NO_STATICS: why and how to use it.

Modified:
    trunk/Wishlist
    trunk/doc/userman/userman.dbx

Modified: trunk/Wishlist
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=1811&r1=1810&r2=1811&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Sat Oct 27 09:46:54 2007
@@ -12,10 +12,6 @@
     The items in this section are those things we definitely want to
     get done in v3.0.  Most of them break the ABI, so they can't wait
     for a future version, because v4 could be years out.
-
-       o Update userman references to util module
-       
-       o Document MYSQLPP_SSQLS_NO_STATICS
 
     o Audit use of headers in lib/*.h, to reduce dependencies.
 

Modified: trunk/doc/userman/userman.dbx
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/doc/userman/userman.dbx?rev=1811&r1=1810&r2=1811&view=diff
==============================================================================
--- trunk/doc/userman/userman.dbx (original)
+++ trunk/doc/userman/userman.dbx Sat Oct 27 09:46:54 2007
@@ -1647,6 +1647,42 @@
 
 
     <sect2>
+        <title>Using an SSQLS in Multiple Modules</title>
+
+        <para>Unless you use one of the emasculated forms of SSQLS
+        described below, you'll run into a problem when trying to
+        use it in more than one module. The more advanced forms of
+        SSQLS include a few static data members to hold information
+        common to all structures of that type. (The table name and
+        the list of field names.) A typical way to run into this
+        is to put the SSQLS definition in a header file and then
+        <userinput>#include</userinput> that in all the modules that
+        need to use SSQLSes of that type. This results in each module
+        defining its own copy of the static data members, which causes
+        a multiply-defined symbol error at link time.</para>
+
+        <para>The way around this is to add this before all but one
+        of the places where you pull in the header definining the
+        SSQLS:</para>
+
+        <programlisting>
+#define MYSQLPP_SSQLS_NO_STATICS</programlisting>
+
+        <para>This suppresses the static data members in any SSQLS
+        defined thereafter.</para>
+
+        <para>These data members must exist, so one (and only
+        one!) module must bring in the SSQLS definition without
+        this being defined. Thus, you don't want to put this
+        <userinput>#define</userinput> in the header file with the
+        SSQLS definition. It's usually easy to find one module in a
+        program that logically "owns" each SSQLS, and it can pull in
+        the header definining the SSQLS directly, without suppressing
+        the static data members.</para>
+    </sect2>
+
+
+    <sect2>
         <title>Harnessing SSQLS Internals</title>
 
         <para>Continuing the discussion in the previous section,


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to