The application framework

Let's take a closer look at the application the New Project Wizard created for us. The first thing you probably noticed is that it is very big as for a Hello World application. That's because Symbian OS (and Series 60) provides a framework for applications and we have to fit into that framework. That's why even such a simple application appart form the view class must have an application class, a document class and a view-control class.

In this chapter we will assume the application name you have chosen on the last wizard page was MyApp.

As you have seen while running the wizard every application has a unique UID. During the development you can use a development UID. To release an application you will need have your private UID. Such UIDs can be obtained free of charge from Symbian. See here for details.

Under Symbian OS applications don't have main() functions that runs the during the whole application lifetime. As it was already mentioned an applications are DLLs which are loaded by the framework (like every DLL they have a E32Dll function but it should return quickly). The framework will run the event loop and call the appropriate methods.

The first function the framework will call will be NewApplication. This function will be exported from the DLL with the special ordinal number 1, so the framework will find it. This function should return an application object. The function prototype tells it should be a subclass of CApaApplication however under Series 60 it is assumed that it should be a subclass of CAknApplication (Akn stands for Avkon - the Series 60 UI library). This function is implemented for you in src\MyApp.cpp and returns a CMyAppApplication object.

File: src\MyApp.cpp

Note that the object was created with the standard new operator, not the new(ELeave) described in Symbian C++ Concepts. That's because the NewApplication don't have an L in the name, so we must not do a leave. Instead we must return NULL if the creation fails and that's exactly what the classic new does.