Tuesday, July 13, 2010

Symbian preparing for the dynamic link library DLL


DLL (Dynamic Link Library) is a special code, which can be an external program in the program
When running call. The code inside the DLL can also be a number of external programs share, and will not cause
Repeated phone memory allocation.

Static interfaces vs polymorphic interface
Symbian system supports two types of DLL:
(1) Static Interface DLL
(2) The polymorphic interface DLL

Static Interface DLL when the program starts in the melody is automatically loaded to the phone memory inside (the only exception is
If the DLL is read-only memory inside the ROM, it can be called by its address). And
If there is no external program to use it, and it will be automatically unloaded from memory. Static Interface DLL in the system
Provide a range of unique functions (for example, the two have the same DLL export functions in the system will not be confused)
Static Interface DLL has. Dll file suffix, often used to implement the system in the Symbian application engines
(For example, has nothing to do with the UI code).

Polymorphic interface DLL is only clear by calling RLibrary:: Load () function can be loaded into memory, and
When uninstalling, also preferably through RLibrary:: Close () function to uninstall. Number of polymorphic interface DLL can
For the external program to export more than the same function name of the function. Therefore, this DLL is widely used in normal circumstances
An application framework to achieve when the plug-in extensions. In the Symbian system, polymorphic interface DLL can
A variety of different file suffixes. The most famous one is. App at the end of the (application),. Ldd (logic
Device drivers),. Tsy and. Csy (telephone and communication services module) and so on. . .

In this article, we will be only concerned with static interfaces DLL technology, it is you and I in the development of DLL far the most common type.
We will continue our common DLL's content.

Static interface DLL
From the perspective of the caller DLL, DLL has three files:
(1) header file:. H file suffix, you can # include into the main theme of the program code to only compile
Useful time.
(2) export file:. Lib file suffix, you can link from the main theme of the procedures, the documentation of the DLL's
All interface functions to provide the name and address.
(3) DLL file itself:. Dll file extension, including all. Lib documented interface function of the specific implementation
The main theme of the function at run time and implement some of the actual call.

From the perspective of writers DLL, DLL can be seen as a complete Symbian project.
It consists of the following components:
(1) project their own MMP file (the file listed in the bld.inf)
(2) a header file, specifies the interface of the DLL needs to export
锛?锛夋簮浠g爜鏂囦欢锛屽叿浣撳鍑哄嚱鏁扮殑瀹炵幇

澶存枃浠?br />DLL鐨勫ご鏂囦欢涓庡叾瀹冪被鐨勫ご鏂囦欢鐨勫ご鏂囦欢闈炲父绫讳技銆備笉鍚岀殑鍦版柟鍦ㄤ簬
浣跨敤浜咺MPORT_C瀹忔潵瀹氫箟鎵?湁瀵煎嚭鍑芥暟锛?br />class CMyEngine : public CBase
(
public:
聽聽 // These functions are visible by the
聽聽 // clients of the DLL and needs to have
聽聽 // the IMPORT_C tag
聽聽 IMPORT_C static CMyEngine* NewL();
聽聽 IMPORT_C static CMyEngine* NewLC();

聽聽 IMPORT_C void MyPublicMethod();
聽聽 IMPORT_C void AnotherPublicMethod();
...
private:
聽聽 // These functions are not visible by the
聽聽 // clients of the DLL and then do not need
聽聽 // the IMPORT_C tag
聽聽 CMyEngine();
聽聽 void ConstructL();
聽聽 void SomePrivateMethod();
)

瀹炵幇鏂囦欢
缂栧啓DLL宸ヤ綔鏈韩娌℃湁浠?箞闇?澶嶆潅鐨勫湴鏂癸紝浣嗘槸鏈変袱涓噸瑕佺殑
鍦版柟闇?鐣欐剰锛?br />锛?锛塃32Dll()鍑芥暟蹇呴』瀹炵幇
锛?锛夊彟澶栦竴涓壒娈婄殑瀹忥紝EXPORT_C锛屽簲璇ュ姞鍦ㄦ瘡涓鍑哄嚱鏁板疄鐜?br />鐨勫墠闈?
For example:
// This function is mandatory for all DLLs
EXPORT_C TInt E32Dll(TDllReason)
(
聽聽聽聽聽聽聽 return KErrNone;
)

// This function is exported: The EXPORT_C tag shall be used.
EXPORT_C void MyPublicMethod()
(
...
)

// This one is not: The EXPORT_C tag shall not be used.
void SomePrivateMethod()
(
聽 // Do Something
)

MMP鏂囦欢
DLL鐨凪MP鏂囦欢搴旇鏈変互涓嬬壒鐐?br />锛?锛夊畾涔夐」鐩?project)鐨勭被鍨嬫槸dll
锛?锛変娇鐢ㄦ纭殑UID2鐨勫?(0x1000008d)

鍦ㄥ紑鍙戣繃绋嬩腑锛屼綘涔熷簲璇ラ?杩嘐XPORTUNFROZEN鍛婅瘔缂栬瘧鐜锛孌LL鎺ュ彛杩樻病鏈?br />瀹氱锛岃繕鍙互闅忔椂淇敼銆?br />
For example:
TARGET聽聽聽聽聽聽聽 MyEngine.dll
TARGETTYPE聽聽聽 dll
UID聽聽聽聽聽聽聽聽聽聽 0x1000008d <myUID3>
...
EXPORTUNFROZEN

鎶奃LL鎺ュ彛瀹氱锛團reezing DLL锛?br />涓?棪浣犲畬鎴愪簡DLL鐨勫紑鍙戯紝鍦ㄤ綘鍙戣浣犵殑DLL鐗堟湰涔嬪墠锛屽簲璇ユ妸鎺ュ彛瀹氱锛團reezing锛?br />杩欐牱鍙互纭畾灏嗘潵鍙戣鐨凞LL鍙互鍚戜笅鍏煎銆?br />
閫氳繃灏嗛」鐩殑MMP鏂囦欢涓殑EXPORTUNFROZEN鍏抽敭瀛楀幓鎺夛紝鐢ㄥ父瑙勭殑鏂规硶閲嶆柊寤虹珛DLL锛?br />鏉ュ疄鐜癉LL搴撶殑瀹氱銆傝繖鏃跺?浼氭湁鈥?def鏂囦欢涓嶅瓨鍦ㄢ?鐨勭紪璇戣鍛婁俊鎭嚭鐜帮紝涓嶈绱э紝
缁х画灏卞缓绔嬪綋鍓嶉」鐩紝鍦ㄩ」鐩紪璇戝畬姣曚互鍚庯紝浣犲彲浠ョ敤濡備笅鍛戒护瀹氱锛?br />abld freeze

娉ㄦ剰:
鎵?湁鐨凙RM骞冲彴鍏变韩涓?釜.def鏂囦欢锛屼絾鏄浜巜ins妯℃嫙鍣ㄥ拰winscw CodeWarrior
鐜鏉ヨ锛屼粬浠湁涓嶅悓鐨?def鏂囦欢銆?br />
涓?棪椤圭洰宸茬粡瀹氱锛岄噸鏂扮敓鎴恗akefile锛岃繖鏃跺?瀵煎叆鐨刲ib浼氱洿鎺ラ?杩囧畾绋跨殑.def
鏂囦欢鐢熸垚銆?br />





相关链接:



YOUTUBE Save + Player Plus



.swf file



Youtube to DAT Box



Free FLV Player



Guide Audio CD Burners



swf Files



SuperBurner WMV to DVD



My Favorite Log Analysers



Pocket DVD Studio



video formats



Open DVD To iPod



Youtube Movie To Xbox Help



Anti-Spam And Anti-Spy Tools Report



flv TO avi



YOUTUBE FLV to 3G2 Platinum



Happiness Audio M3U to Midi Maker



No comments:

Post a Comment