Building a library project in Qt using Qt Creator
This article shows how to create a shared DLL project using Qt Creator. The instructions include the extra step required for the Symbian platform of freezing the API.
- Create a new library project in Qt Creator as shown in the image below. Qt Creator generates all the needed files.
- When compiling the project for Symbian, you will get a warning Frozen .def file \QtSDKProjects\eabi\testLibrary.def not found - project not frozen. This warning reminds you that you need to freeze the exports before release, so as to ensure that subsequent releases are backwards compatible.
Note: The Symbian Platform uses "link by ordinal" (rather than "link by name"). In order to ensure that different versions of the library are compatible, functions have to be exported from the same ordinal position. We achieve this by storing ("freezing") the ordinal position of each function in a .def file, and using this file to define the function position each time the DLL is rebuilt.
Freezing a project
- To begin with, we need to open a command prompt whose environment will be configured for our target platform. For example, to do this on Windows 7 targeting Symbian^3 Qt 4.7.3, you can go under: "Start" -> "All programs" -> "Qt SDK" -> "Symbian^3 Qt 4.7.3" and open Qt 4.7.3 for Symbian^3 Command Prompt
- Once we have the Command Prompt, we change our current working directory to match the directory of the project we need to freeze.
- Then it's time to freeze the project. Type the following command:
abld freeze gcce
If the above operation completed without errors you are done!