Frameworks, Libraries and DLLs

Symbian platform C++ supports two fundamentally different ways of using DLLs, called polymorphic interface DLLs and static interface DLLs. This topic describes these types and for what purposes they are used.

Types of DLL

Like other modern object-oriented systems, the Symbian platform makes extensive use of frameworks. A framework is a software system that defines a collection of abstract base classes and ready-made concrete classes, and which is designed for extension. The framework is shipped as part of the operating system in one or more system DLLs. These DLLs are conventional static interface DLLs, which export functions that can be called by other code that builds against its header files and links against its import library.

To use the framework, a programmer derives a new implementation from its abstract base classes, providing new behaviour where required and making use of the default implementation otherwise. Traditionally on the Symbian platform, the new implementation is then built as what's known as a polymorphic interface DLL. Instead of exporting a table of functions which require an import library in order to identify them correctly, a polymorphic interface DLL exports a single function only at a well known location. Calling this function creates an instance of the newly derived framework class.

An alternative to polymorphic DLLs is supplied by the ECom plug-in architecture. This is a generic framework for specifying plug-in interfaces, and for calling and writing plug-ins. Newer Symbian platform frameworks, such as those for SyncML and for the Transport Architecture, require plug-ins to be written using ECom, rather than polymorphic DLLs. Such frameworks delegate finding and instantiating suitable plug-in objects to ECom, rather than managing these tasks themselves.

Static interface DLLs are also known as shared library DLLs. As well as providing system APIs, they also have a place in applications programming. In a complex project, abstraction and modularisation can be achieved by designing a system as a collection of separate units, each of which encapsulates a piece of the logical design and provides it as a black box to the rest of the system. Each unit is known to others only by its API, and is built as a library DLL.

The Symbian platform build environment is designed to minimise the complexity to Symbian developers of working with multiple program types. Every project is fully specified by its project file, and makefiles are generated from project files by the toolchain. Correctly declaring the target type in the project file will ensure the correct build process and generate an appropriate target. Thus, ECom plug-ins are built as as plugin type targets, and static interface DLLs as dll type targets.

Use of frameworks

Frameworks are a natural extension of the programming style which encourages memory efficient code reuse by implementing system APIs in DLLs. (In contrast, older systems require that object code libraries be linked in statically with every executable which uses them.) Frameworks take the notion of an API a step further and provide both architecture and ready-made building blocks for re-use. This makes them well suited to OO systems.

For most Symbian developers most of the time, therefore, working with the Symbian platform means working with frameworks. This includes all programs which use the Application Architecture or the UIKON GUI framework. It also includes more specialist programming, including printer driver and device driver implementation, as well as writing new hardware abstractions to extend existing subsystems like comms or telephony, and implementing new protocols to extend the networking subsystem.