delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/08/05:31:57

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

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019