[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

exceptions in shared library

From: ING GmbH
Subject: exceptions in shared library
Date: Mon, 30 Oct 2000 16:52:37 +0100

I have a problem if I throw an exception in shared library and catch it in
main-program. I've written a small piece of code which shows it:

//this is my shared library shared.cxx
//to compile: g++ -Wall -shared -o shared.so shared.cxx
extern "C" void ffshared()
  throw 123;

//and this is my main-program main.cxx
//to compile: g++ -Wall -o sharedtest main.cxx -ldl
#include <stream.h>
#include <dlfcn.h>
int main()
void* libHandle = dlopen("shared.so", RTLD_LAZY);
void* fHandle = dlsym(libHandle, "ffshared");
void (*pf)() = (void(*)())fHandle;

} catch (int i){
  cout << "catched "<<i<<"\n";

If I compile it all with gcc 2.91.66 it works. But if I use 2.95.2 the program
aborted with "Memory access error" after the exception is thrown.
Is it a bug in 2.95.2? Or there is a compiler-option which I should to set?
Gennady Maly

reply via email to

[Prev in Thread] Current Thread [Next in Thread]