From 50d9dce7af25fd38a4b4deb0d6d14959770144d0 Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Sat, 23 Jan 2010 15:31:00 +0000 Subject: [PATCH] Make sure BasicError<> typeinfo symbol is published in the shared library, provide a test case in exifprint.cpp --- samples/exifprint.cpp | 6 ++++-- src/error.hpp | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/samples/exifprint.cpp b/samples/exifprint.cpp index 31599949..08d60117 100644 --- a/samples/exifprint.cpp +++ b/samples/exifprint.cpp @@ -44,7 +44,9 @@ try { return 0; } -catch (Exiv2::AnyError& e) { - std::cout << "Caught Exiv2 exception '" << e << "'\n"; +//catch (std::exception& e) { +//catch (Exiv2::AnyError& e) { +catch (Exiv2::Error& e) { + std::cout << "Caught Exiv2 exception '" << e.what() << "'\n"; return -1; } diff --git a/src/error.hpp b/src/error.hpp index 80b659d2..8cf6a8bd 100644 --- a/src/error.hpp +++ b/src/error.hpp @@ -94,28 +94,28 @@ namespace Exiv2 { provided to print errors to a stream. */ template - class BasicError : public AnyError { + class EXV_DLLPUBLIC BasicError : public AnyError { public: //! @name Creators //@{ //! Constructor taking only an error code - explicit BasicError(int code); + EXV_DLLLOCAL explicit BasicError(int code); //! Constructor taking an error code and one argument template - BasicError(int code, const A& arg1); + EXV_DLLLOCAL BasicError(int code, const A& arg1); //! Constructor taking an error code and two arguments template - BasicError(int code, const A& arg1, const B& arg2); + EXV_DLLLOCAL BasicError(int code, const A& arg1, const B& arg2); //! Constructor taking an error code and three arguments template - BasicError(int code, const A& arg1, const B& arg2, const C& arg3); + EXV_DLLLOCAL BasicError(int code, const A& arg1, const B& arg2, const C& arg3); //! Virtual destructor. (Needed because of throw()) - virtual ~BasicError() throw(); + EXV_DLLLOCAL virtual ~BasicError() throw(); //@} //! @name Accessors //@{ - virtual int code() const throw(); + EXV_DLLLOCAL virtual int code() const throw(); /*! @brief Return the error message as a C-string. The pointer returned by what() is valid only as long as the BasicError object exists. @@ -131,7 +131,7 @@ namespace Exiv2 { private: //! @name Manipulators //@{ - void setMsg(); + EXV_DLLLOCAL void setMsg(); //@} // DATA