Boost logo

Boost Users :

Subject: Re: [Boost-users] [exception] What's wrong withboost::get_error_info?
From: Markus Schweiß (M.Schweiss_at_[hidden])
Date: 2009-06-02 04:11:26


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;
}


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