Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - C and C++ Programming » Developing UltraLite Applications for Symbian OS

Memory utilization in Symbian OS applications Next Page

Developing applications using CodeWarrior for Symbian


This section outlines the steps to successfully compile and deploy a sample UltraLite application for a Nokia Series 60 device using CodeWarrior for Symbian version 3.1. The source code and project files for this sample program are located in samples-dir\UltraLite\SymbianTutorial\

To compile the tutorial application
  1. Prepare the tutorial files.

    Copy the tutorial directory (including subfolders) from the SQL Anywhere installation to your C: drive if you are using CodeWarrior for Symbian version 3.1. CodeWarrior 3.1 only allows importing a project file (.mpp extension) from the C: drive. Although it is not necessary to do this if you are using CodeWarrior v3.0 or an earlier version, the rest of this procedure assumes this step has been performed.

    xcopy /s %SQLANYSAMP10%\UltraLite\SymbianTutorial\ C:\Symbian\ULTutorial

    Copy the UTF8-encoded UltraLite sample database file to the "group" directory of the tutorial. This enables the CodeWarrior packaging script to add the database file to the installer sis file for device deployment. Also copy the sample database file to the virtual file directory of the Nokia Series 60 SDK emulator. This is for running the UltraLite tutorial in the emulator. The environment variable "%EPOC_ROOT%" is normally already set to the location of the EPOC32 directory in the SDK.

    copy %SQLANYSAMP10%\UltraLite\CustDB\custdb.utf8.udb C:\Symbian\ULTutorial\group\custdb.udb
    copy %SQLANYSAMP10%\UltraLite\CustDB\custdb.utf8.udb %EPOC_ROOT%\winscw\c
    

    Copy the UltraLite runtime dll and library file to the Nokia Series 60 SDK build target directory.

    copy %SQLANY10%\ultralite\Symbian\winscw\ulrt10.dll %EPOC_ROOT%\release\winscw\udeb
    copy %SQLANY10%\ultralite\Symbian\winscw\lib\ulimp.lib %EPOC_ROOT%\release\winscw\udeb
    
    copy %SQLANY10%\ultralite\Symbian\thumb\ulrt10.dll %EPOC_ROOT%\release\thumb\urel
    copy %SQLANY10%\ultralite\Symbian\thumb\lib\ulimp.lib %EPOC_ROOT%\release\thumb\urel
  2. Import the mmp project file into CodeWarrior for Symbian IDE.

    1. Launch the CodeWarrier IDE.

    2. Choose File > Import Project from mmp files.

    3. Select the vendor: Vendor Nokia/SDK Series 60 2.0+.

    4. Choose the platform, either WINSCW or THUMB.

  3. Add the UltraLite include path to the project settings.

    1. Choose Edit > WINSCW UDEB Settings > Target Settings Panels > Target > Access Paths > User Paths.

    2. Click Add to add %SQLANY10%\h to User Paths (use the absolute path without environment variable).

    3. Change the build target to THUMB UREL and do the same.

    4. Click Add to add %SQLANY10%\h to User Paths (use the absolute path without environment variable).

  4. Build the application.

    1. Change target to WINSCW, and then choose Project > Make.

      You can now run the application in the Emulator environment by choosing Project > Run.

    2. Change target to THUMB UREL, and then choose Project > Make.

      This compiles the project for the device environment.

  5. Create the package for device.

    1. Edit the group\ULTutorial.pkg file: replace references to the Epoc32 folder with your %EPOC_ROOT% setting (environment variables are not recognized in the .pkg file, so you must specify the absolute path) and replace the path to custdb.udb with the location of the sample database on your computer.

    2. Under the THUMB UREL target, right-click the source to add the file group\ULTutorial.pkg.

    3. Build the project for target THUMB UREL again and make certain that the file group\Application.sis has been created. This is the file that is deployed to the device.

  6. Deploy to the device.

    To deploy the tutorial application to a Nokia Series 60 phone, you must connect to the device (using a USB cradle or a wireless connection—either Bluetooth or IRDA) and use the Nokia PC Suite software to transfer the Application.sis file to the phone.

Notes about the tutorial program

The tutorial program directory contains a number of files. Most of the files are concerned with the user interface (GUI) on the phone. The main UltraLite application code is in the file named ULTutorialDB.cpp located in the \src subdirectory.

There are some considerations regarding the location of the database file on the phone and how to reference that in the UltraLite connection code. The C++ code to connect to the database uses the setting DBF=C:\\custdb.udb to specify the file name (and path) for the database file. This indicates the database file is deployed in the main phone memory (not on a storage card).

If the application fails to start on the phone there is a strong possibility that the location of the database file is not correct.