public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Compiling libgui with Tk 8.3.
@ 2001-08-13 17:14 Mo DeJong
  2001-08-13 17:26 ` Keith Seitz
  0 siblings, 1 reply; 3+ messages in thread
From: Mo DeJong @ 2001-08-13 17:14 UTC (permalink / raw)
  To: insight

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,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Compiling libgui with Tk 8.3.
  2001-08-13 17:14 PATCH: Compiling libgui with Tk 8.3 Mo DeJong
@ 2001-08-13 17:26 ` Keith Seitz
  2001-08-13 17:33   ` Mo DeJong
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2001-08-13 17:26 UTC (permalink / raw)
  To: Mo DeJong; +Cc: insight

On Mon, 13 Aug 2001, Mo DeJong wrote:

> 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.

Let's give it a try. (Does anyone use tkCanvEdge.c stuff?? I don't think
we do in Insight...)

Keith

>
> 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,
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Compiling libgui with Tk 8.3.
  2001-08-13 17:26 ` Keith Seitz
@ 2001-08-13 17:33   ` Mo DeJong
  0 siblings, 0 replies; 3+ messages in thread
From: Mo DeJong @ 2001-08-13 17:33 UTC (permalink / raw)
  To: insight

On Mon, 13 Aug 2001, Keith Seitz wrote:

...

> > 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.
> 
> Let's give it a try. (Does anyone use tkCanvEdge.c stuff?? I don't think
> we do in Insight...)
> 
> Keith

I think Source-Navigator is the only project that uses this graph
stuff.

Mo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-08-13 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-13 17:14 PATCH: Compiling libgui with Tk 8.3 Mo DeJong
2001-08-13 17:26 ` Keith Seitz
2001-08-13 17:33   ` Mo DeJong

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).