Menu

WINWCE 0x420 Exception handling & stack unwi

Developers
Artur Bać
2009-04-19
2013-05-13
  • Artur Bać

    Artur Bać - 2009-04-19

    Recently i found that implementation of missing functions needed by exception handling on windows ce 0x420 (not PocketPC2003 for which there is ccrtrtti.lib) could be easly implemented.

    All we need to implemnt in our application compiled with /GX on evc4 is:

    #include  <typeinfo>

    type_info::~type_info()
    {}
    int type_info::operator==(const type_info& rhs) const
    {
       return strcmp(_m_d_name, rhs._m_d_name) == 0;
    }
    int type_info::operator!=(const type_info& rhs) const
    {
       return strcmp(_m_d_name, rhs._m_d_name) != 0;
    }
    int type_info::before(const type_info& rhs) const
    {
       return strcmp(_m_d_name, rhs._m_d_name);
    }
    const char* type_info::name() const
    {
       return _m_d_name;
    }
    const char* type_info::raw_name() const
    {
       return _m_d_name;
    }

    from this point everything works perfectly with exception handling and stack unwind

    like code below

    struct out_of_range{};
    struct runtime_error{};
    struct invalid_argument{};

    try {
       throw out_of_range();
    }
    catch( runtime_error const & )
    {
       AfxMessageBox(_T("catch runtime_error"));
    }
    catch( out_of_range const &)
    {
       AfxMessageBox(_T("catch out_of_range"));
    }
    catch( invalid_argument const &)
    {
       AfxMessageBox(_T("catch invalid_argument"));
    }
    catch(...)
    {
       AfxMessageBox(_T("..."));
    }

    It would be nice in the future that STLPort will use this when building for WCE_PLATFORM_STANDARDSDK WINCE0x420

     
    • Artur Bać

      Artur Bać - 2009-04-20

      Also i had to put this implementation to.

      void __cdecl __ehvec_ctor(void * __t, unsigned int __s , int __n, void (__cdecl*__f)(void *), void (__cdecl* __d)(void *))
      {
          while (-- __n >= 0) {
              (*__f) (__t);
              __t = (char *) __t + __s;
          }
      }

      //eh vector destructor iterator(pA,sizeof(A),count,&A::~A);
      void __cdecl __ehvec_dtor(void * pA,unsigned int __Asize, int __n,void (__cdecl*__dtor)(void *))
      {
          pA = (char *) pA + __Asize * __n;
          while (-- __n >= 0) {
              pA = (char *) pA - __Asize;
              (*__dtor) (pA);
          }
      }

       
    • Artur Bać

      Artur Bać - 2009-04-20

      I craeted cogle code project witch clean builds for (ARMV4,ARMV4I) of this ccrtrtti.lib
      http://code.google.com/p/wceccrtrtti/

       

Log in to post a comment.