Subject: Re: g++, opengl, and STDCALL, * __attribute__ ((stdcall)) problem.
From: [email-masked] (Ulisses T. Mello)

1 Dec 1997 17:31:11 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: Colin Peters <[email-masked]>
Cc: GNU-Win32 <[email-masked]>

Thanks Colin. The recommended sintax looks really strange and I wonder
what would be the solution for ponters to functions. For example:

typedef void APIENTRY (APIENTRY * PFNGLARRAYELEMENTEXTPROC) (GLint i);

In this case I changed to:

typedef void APIENTRY (* PFNGLARRAYELEMENTEXTPROC) (GLint i);

and it compiles but in some applications i get a warning message
complaining that the type specifier will be omitted for parameter. Is this
OK? 

Cheers -- ulisses.

On Mon, 1 Dec 1997, Colin Peters wrote:
>
> From: ulisses mello <[email-masked]>
> Date: Saturday, November 29, 1997 10:55 PM
> 
> >I am trying to compile a simple program (cube.c) with g++. I have no
> >problem to compile it using gcc. However, GL/gl.h does not compile in
> >g++. For example, I get the error:
> >
> >sintax error before '__attribute__' on the function
> >
> >WINGDIAP const GLubyte * APIENTRY glGetString( GLenum name);
> >
> >making the substitutions from windows.h it becomes:
> >
> >const GLubyte * __attribute ((stdcall)) glGetString( GLenum name);
> >
> >I am aware the g++ flags an error for things like:
> >
> >int * __stdcall foo(); // but has no problems with
> >int __stdcall *  foo();
> >
> >But changing the order of * in gl.h has not solved the problem.
> 
> I think if you move APIENTRY to the *end* of the function prototype then
> it will work with g++ (and gcc), but, of course, it will stop working with
> other compilers I suspect. If you are just using gcc and g++ then no
> problem, otherwise make separate copies of those headers for gcc/g++.
> 
> WINGDIAP const GLubyte * glGetString( GLenum name) APIENTRY;
> 
> Looks strange, but I think it will work.
> 
> This is, I think, a bug in the C++ parser, and I have no idea if/when it
> will be fixed.
> 
> Good luck,
> Colin.
> 
> -- Colin Peters -- colin at fu.is.saga-u.ac.jp
> -- Saga University Dept. of Information Science
> -- http://www.fu.is.saga-u.ac.jp/~colin
> -- http://www.geocities.com/Tokyo/Towers/6162
> 
> 
> 
> 

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".