This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: Compiling libgui with Tk 8.3.


Here is a patch to get libgui to compile with Tk 8.3.
It should not break anything in the existing build
so I think it should be fine to add now.

If you are interested in some background on this problem,
see this post and some of the followups.

http://sources.redhat.com/ml/cygwin/2001-08/msg00461.html

cheers
Mo

2001-08-12  Mo DeJong  <mdejong@redhat.com>

	* src/tkCanvEdge.c: Work around Windows gcc problem
	initializing a static member with a dll imported
	symbol by assigning the function pointer at runtime.
	Static initialization works just fine in VC++ but
	fails when compiling with the Windows version of gcc.

Index: src/tkCanvEdge.c
===================================================================
RCS file: /cvs/cvsfiles/devo/libgui/src/tkCanvEdge.c,v
retrieving revision 1.3
retrieving revision 1.3.218.1
diff -u -r1.3 -r1.3.218.1
--- tkCanvEdge.c	1998/08/14 01:16:57	1.3
+++ tkCanvEdge.c	2001/08/12 21:44:04	1.3.218.1
@@ -179,9 +179,15 @@
 static Tk_CustomOption arrowShapeOption =
 { ParseArrowShape, PrintArrowShape, (ClientData) NULL};
 
-static Tk_CustomOption tagsOption = {Tk_CanvasTagsParseProc,
-    Tk_CanvasTagsPrintProc, (ClientData) NULL};
+/*
+ * The callbacks for tagsOption are initialized in ConfigureEdge()
+ */
 
+static Tk_CustomOption tagsOption =
+{ (Tk_OptionParseProc *) NULL,
+  (Tk_OptionPrintProc *) NULL,
+  (ClientData) NULL};
+
 static Tk_ConfigSpec configSpecs[] = {
   {TK_CONFIG_UID, "-arrow", (char *) NULL, (char *) NULL,
      "none", Tk_Offset(EdgeItem, arrow), TK_CONFIG_DONT_SET_DEFAULT},
@@ -530,6 +536,17 @@
 
   tkwin = Tk_CanvasTkwin(canvas);
   bgBorder = ((TkCanvas *) canvas)->bgBorder;
+
+  /*
+   * Init callbacks in tagsOption before accessing configSpecs.
+   * This init can't be done statically when using Windows gcc
+   * since these symbols are imported from the Tk dll.
+   */
+
+  if (tagsOption.parseProc == NULL) {
+    tagsOption.parseProc = Tk_CanvasTagsParseProc;
+    tagsOption.printProc = Tk_CanvasTagsPrintProc;
+  }
 
   if (Tk_ConfigureWidget(interp, tkwin,
 			 configSpecs, argc, argv,


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]