glwDrawingAreaWidgetClass

Jon TURNEY jon.turney@dronecode.org.uk
Tue Oct 14 19:37:00 GMT 2014


On 13/10/2014 02:48, Chris Carlson wrote:
> I have a fairly large program that I developed on Fedora Linux.  It uses
> glwDrawingAreaClassRec to create a GL window.  I attempted to compile
> and run it on Cygwin, and I got the failure.
>
> I added a print statement just before calling XtCreateManagedWidget()
> and discovered the value was 0 on Cygwin and an address on Linux.  I
> presumed that meant there was an issue.
>
> To get around the problem, I downloaded the source from Mesa and
> compiled it myself.  The .a that was generated identifies the following
> (using nm):
>
> 0000000000000640 D glwDrawingAreaClassRec
> 0000000000000728 D glwDrawingAreaWidgetClass
>
> I then compared it to /lib/libGLw.dll.a and got this:
>
> nm /lib/libGLw.dll.a | grep DrawingAreaClass
> 0000000000000000 I __imp_glwMDrawingAreaClassRec
> 0000000000000000 I __nm_glwMDrawingAreaClassRec
> 0000000000000000 I __imp_glwDrawingAreaClassRec
> 0000000000000000 I __nm_glwDrawingAreaClassRec

Unfortunately, this isn't telling you anything useful as the __imp 
import symbols are fixed up at run-time.

> Now I tried compiling your test program and found that it did work as
> you showed, but I then added the include of GLwDrawA.h, and it fails.
> This doesn't make a whole lot of sense to me, and it doesn't seem right.

The issue is that without the extern, the declaration of 
glwDrawingAreaWidgetClass is also a 'tentative definition'

If there are no other references to symbols in libGLw, then that 
tentative definition (with a value of 0) will be used by ld as the 
definition.

(Linking with a shared library on linux is more relaxed)

> What do you think?  If I want to use the GLwDrawingAreaWidgetClass, I
> would presume that I should include the corresponding header file and
> the class would be defined.

On 07/10/2014 14:50, Jon TURNEY wrote:
> but this isn't testing correctly as glwDrawingAreaWidgetClass isn't marked as extern in GLwDrawA.h

Sorry, I should have said something like 'it's a bug that 
glwDrawingAreaWidgetClass isn't marked as extern in GLwDrawA.h'

So, something like the following attached patch to GLwDrawA.h is needed.

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

-------------- next part --------------
--- GLwDrawA.h.bak	2014-10-13 13:00:18.140625400 +0100
+++ GLwDrawA.h	2014-10-13 13:01:06.581762300 +0100
@@ -136,7 +136,7 @@
 typedef struct _GLwMDrawingAreaClassRec	*GLwMDrawingAreaWidgetClass;
 typedef struct _GLwMDrawingAreaRec	*GLwMDrawingAreaWidget;
 
-GLAPI WidgetClass glwMDrawingAreaWidgetClass;
+extern GLAPI WidgetClass glwMDrawingAreaWidgetClass;
 
 
 #else
@@ -144,7 +144,7 @@
 typedef struct _GLwDrawingAreaClassRec	*GLwDrawingAreaWidgetClass;
 typedef struct _GLwDrawingAreaRec	*GLwDrawingAreaWidget;
 
-GLAPI WidgetClass glwDrawingAreaWidgetClass;
+extern GLAPI WidgetClass glwDrawingAreaWidgetClass;
 
 
 #endif
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/


More information about the Cygwin-xfree mailing list