This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Sparc version of gcc 2.95 can't catch from shared library throw
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Sparc version of gcc 2.95 can't catch from shared library throw
- From: David Barto <barto at visionpro dot com>
- Date: Mon, 16 Aug 1999 07:33:16 -0700
- Organization: visionpro.com
I never saw a reply to this.
Gcc version - 2.95
Architecture - Sparc Ultra 10
the report from 'gcc -v' is
Reading specs from
/usr/local/gcc-295/lib/gcc-lib/sparc-sun-solaris2/2.95/specs
gcc version 2.95 19990728 (release)
This bug is not listed on the GCC bugs page. It is a simple
problem of having shared libraries on an Ultra throw an exception
and having the main program catch them.
barto
barto@visionpro.com
# This is a shar archive. Extract with sh, not csh.
echo throw/
mkdir throw
# This is a shar archive. Extract with sh, not csh.
echo x - throw/buildme
cat > throw/buildme << '--end_of_throw/buildme--'
/usr/local/gcc-295/bin/g++ -c -fPIC -g -mcpu=v8 -mtune=ultrasparc -DSVR4
-DTHREAD -D_REENTRANT -ansi -pedantic throw.c -o throw.o
/usr/local/gcc-295/bin/ld -o libthrow.so.1.0 -shared throw.o
ln libthrow.so.1.0 libthrow.so
/usr/local/gcc-295/bin/g++ -c -g -mcpu=v8 -mtune=ultrasparc -DSVR4
-DTHREAD -D_REENTRANT -ansi -pedantic main.c -o main.o
/usr/local/gcc-295/bin/g++ -o shlib -L. main.o -lthrow
--end_of_throw/buildme--
echo x - throw/main.c
cat > throw/main.c << '--end_of_throw/main.c--'
#include <stdio.h>
#include "throw.H"
int
main()
{
cseg *p;
try {
p = new (1) cseg();
}
catch (nohw) {
printf("nohw!\n");
exit(1);
}
printf("WOW!\n");
}
--end_of_throw/main.c--
echo x - throw/throw.H
cat > throw/throw.H << '--end_of_throw/throw.H--'
#include <sys/types.h>
class nohw{};
class cseg {
public:
void *operator new(size_t, int);
};
--end_of_throw/throw.H--
echo x - throw/throw.c
cat > throw/throw.c << '--end_of_throw/throw.c--'
#include "throw.H"
void *
cseg::operator new(size_t amt, int args)
{
throw nohw();
}
--end_of_throw/throw.c--
echo End of distribution
exit 0
echo End of distribution
exit 0
--
David Barto barto@network.ucsd.edu barto@visionpro.com
>From a Marketing type:
Don't give me any technical reason why something can't be done.
If you really believed in the product you'd make it work.