Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <42DE917E.45C144FC@dessent.net>
Date: Wed, 20 Jul 2005 11:01:34 -0700
From: Brian Dessent <brian@dessent.net>
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: g++ problem when attempting to cast a function pointer in an OpenGL   GLU callback
References: <1075213EFAF9BA4181A250B072635947F14C8A@AMR-EX6.ds.amrdec.army.mil>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Spam-Report: -5.9/5.0 ---- Start SpamAssassin results  	* -3.3 ALL_TRUSTED Did not pass through any untrusted hosts 	* -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% 	*      [score: 0.0000] 	*  0.0 AWL AWL: From: address is in the auto white-list 	---- End SpamAssassin results
X-IsSubscribed: yes
Reply-To: cygwin@cygwin.com

"Day, Michael A AMRDEC/UAH" wrote:

> test.cpp:72: error: invalid conversion from `void (*)()' to `void (*)()'

Win32 API functions generally use the stdcall calling convention, not
the standard C one.  Your tcbBegin is not defined this way and this
could be what the compiler is trying to tell you, although the error
certainly isn't very clear.

If you look at glu.h:

GLAPI void APIENTRY gluTessCallback (GLUtesselator* tess, GLenum which,
_GLUfuncptr CallBackFunc);

where _GLUfuncptr is defined as:

typedef void (APIENTRY *_GLUfuncptr)();

where APIENTRY expands to "__attribute__ ((__stdcall__))".  So you'll
need to declare your callback with that attribute or else it will not
work.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

