Author: AlbrechtS
Date: 2011-05-24 13:00:56 -0700 (Tue, 24 May 2011)
New Revision: 8736
Log:
Fix constructors for VC++ DLL builds (STR #2645).


Modified:
   branches/branch-1.3/FL/Fl_Hold_Browser.H
   branches/branch-1.3/FL/Fl_Multi_Browser.H
   branches/branch-1.3/FL/Fl_Select_Browser.H
   branches/branch-1.3/src/Fl_Browser.cxx

Modified: branches/branch-1.3/FL/Fl_Hold_Browser.H
===================================================================
--- branches/branch-1.3/FL/Fl_Hold_Browser.H    2011-05-24 18:58:17 UTC (rev 
8735)
+++ branches/branch-1.3/FL/Fl_Hold_Browser.H    2011-05-24 20:00:56 UTC (rev 
8736)
@@ -50,8 +50,12 @@
     The constructor specializes Fl_Browser() by setting the type to 
FL_HOLD_BROWSER.
     The destructor destroys the widget and frees all memory that has been 
allocated.
  */
-  Fl_Hold_Browser(int X,int Y,int W,int H,const char *l=0)
-       : Fl_Browser(X,Y,W,H,l) {type(FL_HOLD_BROWSER);}
+#if defined(FL_DLL)    // implementation in src/Fl_Browser.cxx
+  Fl_Hold_Browser(int X,int Y,int W,int H,const char *L=0);
+#else
+  Fl_Hold_Browser(int X,int Y,int W,int H,const char *L=0)
+       : Fl_Browser(X,Y,W,H,L) {type(FL_HOLD_BROWSER);}
+#endif
 };
 
 #endif

Modified: branches/branch-1.3/FL/Fl_Multi_Browser.H
===================================================================
--- branches/branch-1.3/FL/Fl_Multi_Browser.H   2011-05-24 18:58:17 UTC (rev 
8735)
+++ branches/branch-1.3/FL/Fl_Multi_Browser.H   2011-05-24 20:00:56 UTC (rev 
8736)
@@ -51,8 +51,12 @@
     The constructor specializes Fl_Browser() by setting the type to 
FL_MULTI_BROWSER.
     The destructor destroys the widget and frees all memory that has been 
allocated.
   */
+#if defined(FL_DLL)    // implementation in src/Fl_Browser.cxx
+    Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0);
+#else
     Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0)
        : Fl_Browser(X,Y,W,H,L) {type(FL_MULTI_BROWSER);}
+#endif
 };
 
 #endif

Modified: branches/branch-1.3/FL/Fl_Select_Browser.H
===================================================================
--- branches/branch-1.3/FL/Fl_Select_Browser.H  2011-05-24 18:58:17 UTC (rev 
8735)
+++ branches/branch-1.3/FL/Fl_Select_Browser.H  2011-05-24 20:00:56 UTC (rev 
8736)
@@ -36,21 +36,25 @@
 /**
   The class is a subclass of Fl_Browser
   which lets the user select a single item, or no items by clicking on
-  the empty space.  As long as the mouse button is held down on an 
+  the empty space.  As long as the mouse button is held down on an
   unselected item it is highlighted. Normally the callback is done when the
   user presses the mouse, but you can change this with when().
   <P>See Fl_Browser for  methods to add and remove lines from the browser.
 */
 class FL_EXPORT Fl_Select_Browser : public Fl_Browser {
 public:
-  /** 
+  /**
     Creates a new Fl_Select_Browser widget using the given
     position, size, and label string. The default boxtype is FL_DOWN_BOX.
     The constructor specializes Fl_Browser() by setting the type to 
FL_SELECT_BROWSER.
     The destructor destroys the widget and frees all memory that has been 
allocated.
   */
-  Fl_Select_Browser(int X,int Y,int W,int H,const char *l=0)
-       : Fl_Browser(X,Y,W,H,l) {type(FL_SELECT_BROWSER);}
+#if defined(FL_DLL)    // implementation in src/Fl_Browser.cxx
+  Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0);
+#else
+  Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0)
+       : Fl_Browser(X,Y,W,H,L) {type(FL_SELECT_BROWSER);}
+#endif
 };
 
 #endif

Modified: branches/branch-1.3/src/Fl_Browser.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Browser.cxx      2011-05-24 18:58:17 UTC (rev 
8735)
+++ branches/branch-1.3/src/Fl_Browser.cxx      2011-05-24 20:00:56 UTC (rev 
8736)
@@ -32,6 +32,12 @@
 #include <stdlib.h>
 #include <math.h>
 
+#if defined(FL_DLL)    // really needed for c'tors for MS VC++ only
+#include <FL/Fl_Hold_Browser.H>
+#include <FL/Fl_Multi_Browser.H>
+#include <FL/Fl_Select_Browser.H>
+#endif
+
 // I modified this from the original Forms data to use a linked list
 // so that the number of items in the browser and size of those items
 // is unlimited. The only problem is that the old browser used an
@@ -914,6 +920,30 @@
   icon(line,0);
 }
 
+/*
+  The following constructors must not be in the header file(s) if we
+  build a shared object (DLL). Instead they are defined here to force
+  the constructor (and default destructor as well) to be defined in
+  the DLL and exported (STR #2632, #2645).
+  
+  Note: if you change any of them, do the same changes in the specific
+  header file as well.  This redundant definition was chosen to enable
+  inline constructors in the header files (for static linking) as well
+  as those here for dynamic linking (Windows DLL).
+*/
+#if defined(FL_DLL)
+
+  Fl_Hold_Browser::Fl_Hold_Browser(int X,int Y,int W,int H,const char *L)
+       : Fl_Browser(X,Y,W,H,L) {type(FL_HOLD_BROWSER);}
+
+  Fl_Multi_Browser::Fl_Multi_Browser(int X,int Y,int W,int H,const char *L)
+       : Fl_Browser(X,Y,W,H,L) {type(FL_MULTI_BROWSER);}
+
+  Fl_Select_Browser::Fl_Select_Browser(int X,int Y,int W,int H,const char *L)
+       : Fl_Browser(X,Y,W,H,L) {type(FL_SELECT_BROWSER);}
+
+#endif // FL_DLL
+
 //
 // End of "$Id$".
 //

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to