public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
* glwDrawingAreaWidgetClass
@ 2014-10-07  2:32 Chris Carlson
  2014-10-07 13:50 ` glwDrawingAreaWidgetClass Jon TURNEY
       [not found] ` <0DqF1p0240YP9AS01DqG2B>
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Carlson @ 2014-10-07  2:32 UTC (permalink / raw)
  To: Cygwin XFree

I'm running Cygwin:
CYGWIN_NT-6.1 grover 1.7.32(0.274/5/3) 2014-08-13 23:06 x86_64 Cygwin

under Windows 7.

I've discovered that the constant glwDrawingAreaWidgetClass is set to 
0.  It's supposed to be defined as:

WidgetClass glwDrawingAreaWidgetClass=(WidgetClass)&glwDrawingAreaClassRec;

Is it broken?

Thanks.


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


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

* Re: glwDrawingAreaWidgetClass
  2014-10-07  2:32 glwDrawingAreaWidgetClass Chris Carlson
@ 2014-10-07 13:50 ` Jon TURNEY
       [not found] ` <0DqF1p0240YP9AS01DqG2B>
  1 sibling, 0 replies; 4+ messages in thread
From: Jon TURNEY @ 2014-10-07 13:50 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: cwcarlsonc

On 07/10/2014 03:31, Chris Carlson wrote:
> I've discovered that the constant glwDrawingAreaWidgetClass is set to
> 0.  It's supposed to be defined as:
>
> WidgetClass glwDrawingAreaWidgetClass=(WidgetClass)&glwDrawingAreaClassRec;

Can I ask you to please provide some more details as to how you made 
this discovery?

If you do this:

$ cat glw-test.c
#include <Xm/Xm.h>
#include <GL/GLwDrawA.h>
#include <stdio.h>

int main()
{
    printf("glwDrawingAreaWidgetClass %p", glwDrawingAreaWidgetClass);
}

then you could reach that conclusion:

$ gcc glw-test.c ; ./a
glwDrawingAreaWidgetClass 0x0

but this isn't testing correctly as glwDrawingAreaWidgetClass isn't 
marked as extern in GLwDrawA.h

$ cat glw-test.c
#include <Xm/Xm.h>
#include <stdio.h>

extern WidgetClass glwDrawingAreaWidgetClass;

int main()
{
    printf("glwDrawingAreaWidgetClass %p", glwDrawingAreaWidgetClass);
}

$ gcc glw-test.c -lGLw ; ./a
glwDrawingAreaWidgetClass 0x5bd8e3640

> Is it broken?

I don't know.

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer

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


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

* Re: glwDrawingAreaWidgetClass
       [not found] ` <0DqF1p0240YP9AS01DqG2B>
@ 2014-10-13  1:50   ` Chris Carlson
  2014-10-14 19:37     ` glwDrawingAreaWidgetClass Jon TURNEY
  0 siblings, 1 reply; 4+ messages in thread
From: Chris Carlson @ 2014-10-13  1:50 UTC (permalink / raw)
  To: cygwin-xfree

I apologize for being so vague.

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

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.

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.

Thanks for your time, and I really do appreciate you and Cygwin.
Chris Carlson



On 10/7/2014 6:50 AM, Jon TURNEY wrote:
> On 07/10/2014 03:31, Chris Carlson wrote:
>> I've discovered that the constant glwDrawingAreaWidgetClass is set to
>> 0.  It's supposed to be defined as:
>>
>> WidgetClass 
>> glwDrawingAreaWidgetClass=(WidgetClass)&glwDrawingAreaClassRec;
>
> Can I ask you to please provide some more details as to how you made 
> this discovery?
>
> If you do this:
>
> $ cat glw-test.c
> #include <Xm/Xm.h>
> #include <GL/GLwDrawA.h>
> #include <stdio.h>
>
> int main()
> {
>    printf("glwDrawingAreaWidgetClass %p", glwDrawingAreaWidgetClass);
> }
>
> then you could reach that conclusion:
>
> $ gcc glw-test.c ; ./a
> glwDrawingAreaWidgetClass 0x0
>
> but this isn't testing correctly as glwDrawingAreaWidgetClass isn't 
> marked as extern in GLwDrawA.h
>
> $ cat glw-test.c
> #include <Xm/Xm.h>
> #include <stdio.h>
>
> extern WidgetClass glwDrawingAreaWidgetClass;
>
> int main()
> {
>    printf("glwDrawingAreaWidgetClass %p", glwDrawingAreaWidgetClass);
> }
>
> $ gcc glw-test.c -lGLw ; ./a
> glwDrawingAreaWidgetClass 0x5bd8e3640
>
>> Is it broken?
>
> I don't know.
>


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


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

* Re: glwDrawingAreaWidgetClass
  2014-10-13  1:50   ` glwDrawingAreaWidgetClass Chris Carlson
@ 2014-10-14 19:37     ` Jon TURNEY
  0 siblings, 0 replies; 4+ messages in thread
From: Jon TURNEY @ 2014-10-14 19:37 UTC (permalink / raw)
  To: cygwin-xfree; +Cc: cwcarlsonc

[-- Attachment #1: Type: text/plain, Size: 2203 bytes --]

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


[-- Attachment #2: GLwDrawA.h.patch --]
[-- Type: text/plain, Size: 629 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 223 bytes --]

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

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

end of thread, other threads:[~2014-10-14 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-07  2:32 glwDrawingAreaWidgetClass Chris Carlson
2014-10-07 13:50 ` glwDrawingAreaWidgetClass Jon TURNEY
     [not found] ` <0DqF1p0240YP9AS01DqG2B>
2014-10-13  1:50   ` glwDrawingAreaWidgetClass Chris Carlson
2014-10-14 19:37     ` glwDrawingAreaWidgetClass Jon TURNEY

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