This is the mail archive of the cygwin@sourceware.cygnus.com
mailing list for the Cygwin project. See the Cygwin
home page for more information.
Re: set_new_handler
- To: Sven.Wastlund@epkadm.epk.ericsson.se (Sven Wastlund)
- Subject: Re: set_new_handler
- From: Mumit Khan <khan@xraylith.wisc.EDU>
- Date: Thu, 08 Apr 1999 10:48:05 -0500
- cc: cygwin@sourceware.cygnus.com
Sven.Wastlund@epkadm.epk.ericsson.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@sourceware.cygnus.com