[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
exceptions in shared libraries
From: |
Dirk Habighorst |
Subject: |
exceptions in shared libraries |
Date: |
Tue, 29 Oct 2002 15:20:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020826 |
Hallo,
is there a general problem with c++, exceptions and shared libraries
created with libtool?
Properties and PropertiesException are classes from a shared library
created with libtool (1.4.3).
#include "properties.h"
#include <iostream>
Properties::Properties(){
}
Properties::~Properties(){
}
Properties::Properties(const Properties & defaults){
_properties = defaults._properties;
}
std::string Properties::getProperty(std::string key)
throw(PropertiesException){
std::map<std::string, std::string>::iterator i = _properties.find(key);
if(i!=_properties.end()){
return i->second;
}
else{
throw PropertiesException("Error: The key " + key + " does not
exist in the properties.");
}
}
Whenever I use getProperty and it should throw and the exception the
program aborts.
Here is the backtrace:
#0 0x4081d581 in kill () from /lib/libc.so.6
#1 0x4081d394 in raise () from /lib/libc.so.6
#2 0x4081e8d1 in abort () from /lib/libc.so.6
#3 0x407a2cf4 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.4
#4 0x407a2d39 in std::terminate() () from /usr/lib/libstdc++.so.4
#5 0x407a2e8d in __cxa_throw () from /usr/lib/libstdc++.so.4
#6 0x4005361f in Properties::getProperty(std::string) (this=0xbffff364,
key=Cannot access memory at address 0x88f7a5c
) at properties.cpp:37
#7 0x080496e4 in main (argc=1, argv=0xbffff434) at main.cpp:38
If I use the static library or create a shared library with g++
everything works as it should.
thanks dirk
- exceptions in shared libraries,
Dirk Habighorst <=