delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/04/08/11:49:51

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-Id: <199904081548.KAA12651@modi.xraylith.wisc.edu>
X-Authentication-Warning: modi.xraylith.wisc.edu: localhost.xraylith.wisc.edu [127.0.0.1] didn't use HELO protocol
To: Sven DOT Wastlund AT epkadm DOT epk DOT ericsson DOT se (Sven Wastlund)
cc: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: set_new_handler
In-reply-to: Your message of "Thu, 08 Apr 1999 17:20:26 +0200."
<199904081520 DOT RAA08052 AT epkws1038 DOT epk DOT ericsson DOT se>
Date: Thu, 08 Apr 1999 10:48:05 -0500
From: Mumit Khan <khan AT xraylith DOT wisc DOT EDU>

Sven DOT Wastlund AT epkadm DOT epk DOT ericsson DOT se (Sven Wastlund) writes:
> I am porting a program from UNIX to NT which uses the function set_new_handle
> r and I linked it with libgcc.a but I still got the error:
> 
> undefined reference to set_new_handler

Without any code, it's impossible to figure out why you're getting this.
Post a short test case and someone will look into it. Short answer is
that it's there and it works.

Are you including <new> in your code to pick up the right prototype?

> Is there any other library I can use?

no.

here's a quick example (haven't tested it, so beware for syntax errors
and so on):

  #include <new>
  #include <iostream>

  void my_handler () {
    cerr << "no more memory" << endl;
    abort ();
  }

  int main( void ) {
   set_new_handler (&my_handler);
   int *foo = new int [100000000];
  }

$ c++ -o new-handler new-handler.cc
$ ./new-handler

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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