public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Mo DeJong <mdejong@cygnus.com>
To: insight@sources.redhat.com
Subject: PATCH: Compiling libgui with Tk 8.3.
Date: Mon, 13 Aug 2001 17:14:00 -0000	[thread overview]
Message-ID: <Pine.SOL.3.91.1010813170542.12157C-100000@cse.cygnus.com> (raw)

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,

             reply	other threads:[~2001-08-13 17:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-13 17:14 Mo DeJong [this message]
2001-08-13 17:26 ` Keith Seitz
2001-08-13 17:33   ` Mo DeJong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.SOL.3.91.1010813170542.12157C-100000@cse.cygnus.com \
    --to=mdejong@cygnus.com \
    --cc=insight@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).