Known Issues

ARM RVCT compiler issues with STLport

Due to a defect in the ARM RVCT compiler versions 2.2, 3.1 and 4.0, building STLport v4 or STLport-based applications, creates some invalid export entries in DEF files. To workaround this issue, perform the following steps:

  1. Use the GCCE compiler to generate the DEF file, if it is not available.

  2. Ignore the warnings generated by the ARM RVCT compiler.

    Note: When you ignore the warnings, do not freeze the invalid export entries in the DEF file using the ARM RVCT compiler.

Use of Global Destructor

Symbian does not invoke destructors of global objects upon program termination. For example, in the code below, the destructor ~foo() is not called upon program termination. At the moment, it is advised not to perform any important operations using destructors.

        #include 
using namespace std; 
class foo
{
public:
foo()
{
cout <<"Entering foo\n"; 
}
~foo()
{
cout <<"Leaving foo\n";
}
};
foo foo_bar; 
int main(void)
{
return 0;
}
       

Issues with new operator

Throwing bad_alloc or any object from new on ARMV5 platfrom crashes. RVCT reports an exception when new throws bad_alloc . The problem occurs even if the user throws any object from within an overloaded operator new . The following new signatures are affected:

        void *operator new(unsigned int aSize);
void *operator new[](unsigned int aSize);
       

The following code snippet is an example that depicts the problem:

        class Dummy
{
}; 
void *operator new(unsigned int aSize)
{
void* __y = malloc(aSize);
// try to simulate bad alloc
if (__y == 0)
{
throw Dummy(); //this will result in a crash
}
return __y;
}
       

To implement user owned overloaded version of new, the user must implement them as class specific. The other way this could be achieved is by defining new similar to:

        void* operator new(size_t s,newarg) throw (std::bad_alloc)
       

and invoking it as:

        Myclass* my = new(S60) Myclass()
       

The id Member Issue

The id member variable of facet classes cannot be accessed directly, it has to be accessed via the GetFacetLocaleId() interface.

Following code snippet is an example that illustrates how to uselocale::id while writing an application on top of the Standard Template Library (STL). Declare a static method GetFacetLocaleId() instead of the member variable id when, defining a class base_facet inherited from locale::facet in a header file.

        //b_facet.h 
class base_facet : public locale::facet 
{ 
public: 
static locale::id; 
GetFacetLocaleId(); // in place of static locale::id
id; 
};
       

In the source file define the method GetFacetLocaleId() .

        //b_facet.cpp
locale::id base_facet_id; 
locale::id& base_facet::GetFacetLocaleId()
{ 
return base_facet_id; 
}
       

Interleaving Symbian and Standard C++ Code

The user must exercise caution while using try or catch , and trap while interleaving Symbian C++ and Standard C++ code. Adapter code is required to handover or suppress exception coming from the Standard C++ to Symbian C++ code.

Following code snippet illustrates how to use the adaptor code. Adaptor code can be a part of DLLA.

DLL A - Symbian C++ code

        void CDoIt::Doit()
{
   class foo *p = new __foo__();
   p->bar();
   delete p;
};
       

DLLB - Standard C++ code

        class foo {
public:
  foo(); //constructor
  bar(); // throw exception
};
       

DLLC - Adaptor code

        class __foo__ {
  foo *p;
public:
  __foo__();
  bar();
};

void __foo__::__foo__()
{
   int err = 0;
   try {
      p = new foo();
   } catch {
     err = some error
   }
   User::LeaveIfError(err);
};
void __foo__::bar()
{
   int err = 0;
   try {
      p->bar();
   } catch {
     err = some error
   }
   User::LeaveIfError(err);
};