Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Mon, 8 Jul 2002 19:31:32 +1000
From: Anurag Sharma <anurag@proximity.com.au>
To: cygwin@cygwin.com
Subject: g++ and function pointers calling convention
Message-Id: <20020708193132.6b275b71.anurag@proximity.com.au>
Organization: Proximity
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi All,

We have gcc compiler(3.04) build as a cross compiler for cygwin (host is
linux).
Consider the following code :

/********************************/
#include <iostream>

typedef void * __stdcall  hell (unsigned int) ;  

int
main(int argc, char* argv[])
{   
    std::cout<<"made it "<<std::endl;
}
/*********************************/

Compiling this with g++, causes the executable to crash straight away with
segmentation fault. (There are no errors or warnings while compiling).

If I use stdio.h and printf instead, the executable works fine. i.e. it
works for C but not for C++.

Now if I change the typedef as follows :

typedef void *  hell (unsigned int) __stdcall ;

It works for   both C++ and C.

Now my question is as follows:

 If this is a characterstic of the gnu compiler, what do we do with
typedefs of this nature found everywhere in win32api/* header files???  

Its impracticle to change all these typedefs. Can we provide a special
config parameter while creating the cross compiler??

I am raising this issue in the cygwin mailing list, hoping that other
cygwin users using a cross compiler might be able to help.

Regards,

Anurag

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

