Boost logo

Boost Users :

Subject: Re: [Boost-users] [exception] What's wrong withboost::get_error_info?
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-06-02 15:04:21


2009/6/2 Markus Schweiß <M.Schweiss_at_[hidden]>:
>
> 2009/5/30 Emil Dotchevski <emildotchevski_at_[hidden]>:
>> Long shot, but it looks like you have ABI conflict of some sort. Could
>> you post a simple, complete program that demonstrates your problems?
>
> Here is the complete sourcecode of a Win32 console application that reproduces my problem.
> And shame on me, I forgot to mention that my application as well as the Boost libraries uses STLport version 5.0.2
>
>
> #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
> #include <stdio.h>
> #include <tchar.h>
> #include <boost/exception.hpp>
>
>
> class MyBoostException : public boost::exception
> {
> public:
> MyBoostException() { /*do nothing*/ };
> virtual ~MyBoostException() { /*do nothing*/ };
> };
>
> void DoSomething()
> {
> throw MyBoostException() << boost::throw_file( _T(__FILE__) )
> << boost::throw_line( __LINE__ )
> << boost::throw_function( _T("DoSomething()") );
> }
>
> int _tmain( int argc, _TCHAR* argv[] )
> {
> try {
> DoSomething();
> } catch( MyBoostException& ex ) {
>
> boost::shared_ptr<const int> pLine =
> boost::get_error_info<boost::throw_line>(ex);
>
> boost::shared_ptr<const char* const> pMethod =
> boost::get_error_info<boost::throw_function>(ex);
> const char* sMethod = *pMethod;
>
> boost::shared_ptr<const char* const> pFile =
> boost::get_error_info<boost::throw_file>(ex);
> const char* sFile= *pFile;
>
> std::string info = boost::diagnostic_information( ex );
> const char* sString = info.c_str();
>
> }
> return 0;
> }

I am puzzled, but here is another guess.

Boost::throw_line, boost::throw_function and boost::throw_file have
special handling in Boost Exception; adding them to exceptions does
not use anything from STL. So here is something to try: print *pLine,
sMethod and sFile directly. If you get correct strings, then the
problem could be in some interference between STLport and
std::ostringstream. Step into boost::diagnostic_information and see
what is passed into std::ostringstream's operator<<. If the data
entering it is good but the output from .str() is bad, it's definitely
an issue with STLport's installation.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net