Главная » Просмотр файлов » Wiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007

Wiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007 (779887), страница 31

Файл №779887 Wiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007 (Symbian Books) 31 страницаWiley.Developing.Software.for.Symbian.OS.2nd.Edition.Dec.2007 (779887) страница 312018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 31)

You can specify anew name and location for this file by using the DEFNAME statementin the DLL’s MMP file.The keyword nostrictdef can also be usedin the MMP file to cause the U not to be added to the DEF file name.DLL INTERFACE FREEZING147There is an additional DEF file that is generated on each DLL build, andthis should not be confused with the DEF file discussed above.

This fileis an intermediate file, located in the project’s epoc32\build directory,and always reflects the current interface of the DLL. When interfacefreezing is disabled (EXPORTUNFROZEN in your MMP), the import libraryis generated from this intermediate DEF file.First build of a DLLA typical first set of commands to build a DLL without the EXPORTUNFROZEN statement is as follows:cd <your dll build directory>bldmake bldfilesabld build winscwabld freeze winscwabld build winscwDoesn’t it seem strange to run abld build winscw twice? Actually,what is happening is that the first abld build command will successfullybuild the DLL, but will not build an import library since the interfaceis not frozen.

Executing the abld freeze command will examine theinterface of the DLL just built and freeze it (by recording the interfacein a DEF file, as we will see). The next abld build command willsuccessfully generate the import library corresponding to the DLL.You could substitute abld library winscw in place of the last abldbuild winscw command.

This command builds the import library fromthe DEF file just created by the abld freeze winscw command. Theabld build command does this, but it also does a complete DLL build.Now the DLL can be updated as needed and rebuilt. This DLL will bebackward compatible with the last frozen interface and thus will workwith those older frozen import libraries.Sample DEF fileTo illustrate the concept of library freezing a bit further, let’s look at aquick example of a DLL and the .DEF file it generates when the library isfrozen. I used the GCCE native build target for this example.

The followingshows the source code for a sample DLL:// mydll.h#include <e32base.h>class CMyClass : public CBase{public:static CMyClass *NewL();IMPORT_C void FuncA();148IMPORT_CIMPORT_CIMPORT_CIMPORT_Cprotected:IMPORT_C};SYMBIAN OS BUILD ENVIRONMENTvoidvoidvoidvoidFuncB();FuncC();FuncD();FuncE();CMyClass(void);// mydll.cpp#include "mydll.h"EXPORT_C CMyClass *CMyClass::NewL(){return new(ELeave) CMyClass;}CMyClass::CMyClass(){// constructor code here }EXPORT_C void CMyClass::FuncA(){// FuncA code }EXPORT_C void CMyClass::FuncB(){// FuncB code }EXPORT_C void CMyClass::FuncC(){// FuncC code }EXPORT_C void CMyClass::FuncD(){// FuncD code }EXPORT_C void CMyClass::FuncE(){// FuncE code }The listing below shows a sample DEF file generated (by abld freezegcce) for this sample DLL:EXPORTS_ZN8CMyClass4NewLEv @ 1 NONAME_ZN8CMyClass5FuncAEv @ 2 NONAME_ZN8CMyClass5FuncBEv @ 3 NONAME_ZN8CMyClass5FuncCEv @ 4 NONAME_ZN8CMyClass5FuncDEv @ 5 NONAME_ZN8CMyClass5FuncEEv @ 6 NONAMEThe static MyClass::NewL() method is assigned ordinal 1, and functions FuncA() through FuncE() are assigned ordinals 2 through 6 (youcan ignore the characters surrounding the function name).Inserting a new functionIn the example just discussed, suppose you insert a new class method, sayFuncC1(), after FuncC().

If freezing were disabled, the ordinals couldchange in the next build (thus breaking compatibility for applicationsINSTALLING APPLICATIONS ON THE SMARTPHONE149using the older library); however, since the DLL is frozen, you can beassured that the ordinals for the existing functions will remain the sameand FuncC1() will receive the next-higher ordinal (7).

Note that thefrozen import libraries will not have access to this new function yet (youneed to refreeze and release a new import library to use it), but at leastthe other functions will still work correctly.Interface violationLet’s consider what would happen if you froze the example DLL, andthen removed one of the methods (FuncA(), for example). The next timeyou built the DLL, you’d see an error such as the following (again, usingGCCE, the error may differ with other build targets):elf2e32 : Error: E1036: Symbol _ZN8CMyClass7FuncAEv Missing from ELF FileThe reason is that backward compatibility would be broken, since existingapplications may depend on the function you deleted.

To delete thismethod you would need to unfreeze the DLL, and rebuild – and thenfreezing back again to create a new import library to correspond with thenew version of the DLL.Unfreezing a DLLIn some cases you will have frozen the DLL (without releasing it) and thenwant to rearrange things, by either renaming methods or deleting them.You will not be able to build, however, since it will violate the interfacesand you will get errors such as the one just discussed.

To reset, unfreezeyour interface by deleting your project’s DEF file. Then run abld build,abld freeze, abld build. This will create a new DEF with the newinterface.5.9 Installing Applications on the SmartphoneAn application is installed on a smartphone via an installation file that hasa .sis or .sisx extension.

This installation file, which is referred to asa SIS file, contains all the executables and data files for the application. Inaddition, it contains installation information, such as where to put eachexecutable/data file on the target device’s flash memory.You can install a SIS file in several ways:•Using PC suite on the PC.•You can simply click on the SIS file in File Explorer and it will installitself on the smartphone.150SYMBIAN OS BUILD ENVIRONMENT•Download SIS files from the web, WAP, or via email onto thesmartphone itself and install them.•Beam the SIS file to the phone using infrared or Bluetooth technology.The smartphone keeps track of all installed programs, and allowsthe user to uninstall them.

The information from the SIS file is used todetermine which files to delete.To create a SIS file for your program, Symbian provides a tool calledmakesis. The makesis tool takes a package definition file (known as aPKG file.) as input. This is simply a text file that specifies what files areincluded in the package (and their location on the PC) and where thesefiles go on the smartphone. Running makesis with the argument set tothe name of the PKG file will generate the SIS file – ready for installation.Figure 5.3 shows the operation of makesis.5.9.1 Where Do I Put My Files?Let’s look at the key directories on the smartphone device.

The directorystructures differ somewhat between phones, but the ones listed here areconsistent across all devices.Project executables and data filesPKG filemakesis commandSIS fileSIS file signingSmartphoneFigure 5.3makesis FlowINSTALLING APPLICATIONS ON THE SMARTPHONE151• \sys\binThis is where all executables on the phone reside (i.e., all EXE filesand shared libraries). An executable cannot be started if it is not inthis directory.Note that before Symbian OS v9, each application had its ownapplication subdirectory; this is no longer the case. Therefore, youneed to be sure your executable names are unique across all applications. For example, if you name an executable application.exeyou may have a conflict with some other application that has anexecutable with that name.

One way to ensure uniqueness is toappend the UID3 of your executable to its name. Carbide.c++ doesthis automatically when creating applications using its wizard.• \resource\appsThis is where all compiled application resource files are put.• \privateThe \private directory contains reserved, secure subdirectories forstoring data for applications. The subdirectory name is the SECUREIDspecified for the application (which defaults to the application UID),as described earlier in section 5.3.2.

See also section 7.4.8 for a fulldescription of this.• \private\10003a3f\import\appsThis is a special directory under private, where application registrationresources reside. We’ll discuss it later, in Chapter 12.5.9.2Format of the PKG FileTo create a SIS file you need to define a PKG file for your project, whichis used to specify the contents of your SIS file. First I will discuss the basicstatements in the package file using a simple illustrative example, then Iwill talk about some of the more advanced features.A minimum PKG file has two lines describing the application and thetarget smartphone device. These lines are followed by one or more linesthat specify what files on the development PC go in the package file, andwhere those files should be placed on the smartphone when the SIS fileis installed.

The following shows the PKG file from Chapter 2:; SimpleEx.pkg - S60;;Language - standard language definitions&EN; standard SIS file header#{"SimpleEx"},(0xE000027F),1,0,0152SYMBIAN OS BUILD ENVIRONMENT;Localised Vendor name%{"Vendor"};Supports S60 v 3.0[0x101F7961], 0, 0, 0, {"S60ProductID"};;Files to install"c:\Symbian\9.2\S60_3rd_FP1\epoc32\release\gcce\urel\SimpleEx.exe"-"!:\sys\bin\SimpleEx.exe""c:\Symbian\9.2\S60_3rd_FP1\epoc32\data\z\resource\apps\SimpleEx.rsc"-"!:\resource\apps\SimpleEx.rsc""c:\Symbian\9.2\S60_3rd_FP1\epoc32\data\z\private\10003a3f\apps\SimpleEx_reg.rsc" -"!:\private\10003a3f\import\apps\SimpleEx_reg.rsc"Package file commentsLines that begin with a semicolon and blank lines are ignored by makesis.Package headerThe package header contains information about the program that you areinstalling. The format is as follows:#{" program name"},{ProgramUID},Major_Version_#,Minor_Version_#,Build_#[,package options] [,Type=Package Type]In the previous example, the package header is:#{"SimpleEx"},(0xE000027F),1,0,0This indicates that the program’s name is SimpleEx, the UID is0xE000027F, and the version is 1.0.0.

Характеристики

Тип файла
PDF-файл
Размер
3,36 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6451
Авторов
на СтудИзбе
305
Средний доход
с одного платного файла
Обучение Подробнее