Executable Files

The EXE file is the basic executable image file for Symbian OS and all processes reside in one. For example, in Symbian OS v9 and above, GUI applications are EXE files. In Symbian OS releases before v9, a GUI application was actually a DLL, and was launched transparently from an EXE file called apprun.exe.

You may need to implement your own EXE files for non-GUI processes as well, such as if you implement a server. The following example shows a simple EXE:

Tint ExtGlobal=0; // ok to use here in EXE

GLDEF_C Tint E32Main() {

User::After(10 000 00 0); // wait 10 seconds User::InfoPrint(_L("Ping Message"));

ExtGlobal++; // Used to illustrate that you can use // writable globals in exe files

This is the corresponding MMP file for building the source of this EXE:

// exe mmp file

TARGET

myexe.exe

TARGETTYPE

exe

SOURCEPATH

.. \src

SOURCE

myexe.cpp

USERINCLUDE

USERINCLUDE

..\include

SYSTEMINCLUDE

\Epoc32\include

LIBRARY

euser.lib

The executable in the example above loops for ever and displays a message to the screen every 10 seconds. lnfoPrint() function displays a message for a short period of time before it disappears (until invoked again after the next User::After()).

As you can see, the basic structure of an EXE is simple. The EXE only requires the entry point E32Main() and your code takes it from there.

TARGETTYPE exe indicates that the output is an EXE file.

Note that you can use writable static data in EXE files even in pre-Symbian OS v9 versions.

An application can start an EXE file by using the RProcess class, which is discussed in Chapter 9.

0 0

Post a comment

  • Receive news updates via email from this site