Background technology
Dynamic link library, it is the abbreviated form of Dynamic Link Library, dynamic link library (DLL) is the executable file as the Sharing Function storehouse.Dynamic link provides a kind of method, makes process can call the function that does not belong to its executable code.The executable code of function is arranged in a DLL, and this DLL comprises and one or morely separate the function of storing by compiling, link and with the process of using them.DLL also helps to share data and resource.A plurality of application programs are the content of single DLL copy in the access memory simultaneously.DLL is one and comprises the code that can be used simultaneously by a plurality of programs and the storehouse of data.For example, in Windows operating system, Comdlg32 DLL carries out the common function relevant with dialog box.Therefore, each program can use the function that comprises among this DLL to realize the Open dialog box.This helps lend some impetus to effective use of code reuse and internal memory.
By using DLL, program can realize modularization, is made up of relatively independent assembly.For example, the program of accounting can be sold by module.Can be with each module loading in master routine (if corresponding module be installed) when operation.Because module is independent of each other, so the loading velocity of program is faster, and module only just loads when corresponding function is requested.
Under the static library situation, function and data are compiled into a binary file (expansion * .LIB by name usually), and the compiler of Visual C++ will recover these functions and data and they are generated executable file with other module combinations in the application program together from static library when handler code.This process is called " static linkage ", and this moment is because the required full content of application program all is to have copied from the storehouse, so static library itself does not need to issue with executable file.
The advantage of DLL is that when a plurality of programs were used same function library, DLL can reduce the amount of repetition of the code that loads in disk and physical memory.This not only can influence the program at front stage operation greatly, and can influence the program that other move in Windows operating system greatly.
DLL helps lend some impetus to the modular procedure development.This can help your development requires that the large program of a plurality of language versions or the program that requirement has the modular architecture are provided.An example of modular program be have a plurality of can be in the program that accounts of module of when operation dynamic load.
When the function among the DLL need upgrade or repair, dispose and install DLL and do not require linking of the program of rebuliding and this DLL.In addition, if a plurality of program is used same DLL, so a plurality of programs will benefit all will or repairing from this renewal.When you used the third party DLL of regular update or reparation, this problem may occur more continually.
Static-link Library and Dynamic-link be a kind of line module it provide the complete object code (in static library * .lib) of function if the function of the Static-link Library and Dynamic-link in the routine call, then when connecting linker with in the code of this function of comprising copy in the operating file. the object code of its function that provides also has been provided dynamic link libraries, but when program connected function in the dynamic link libraries, linker did not block that the object code that is included in the function in the dynamic link libraries copies to operating file and the positional information that just simply recorded function.
Along with extensively popularizing with intelligent of mobile phone, mobile phone can be installed different application programs and offer functions such as consumer entertainment or recreation, when some DLL is used in a plurality of application programs, name conflict will occur, the programmer has to manually change to different name copies for these DLL, and need update routine, so that these DLL can correctly be loaded, this technology is obscured easily, make mistakes, and all to change program at every turn, recompilate, very trouble.For example, the mobile phone end is installed the mobile TV program earlier, and correspondence A under the storage catalogue of mobile phone comprises a core player storehouse, and this core player storehouse comprises a static library and three dynamic base, respectively called after: tmpc.lib; Tmpc.dll; Net_plugin.dll and Mp4plugin.dll, when mobile TV routine call core player, code among the tmpc.dll is write to be decided to be and is loaded Net_plugin.dll and Mp4plugin.dll, when the mobile phone end is installed a watchdog routine again, it needs equally to use core player storehouse identical with the mobile TV program, then needs manual with tmpc.lib; Tmpc.dll; Net_plugin.dll and Mp4plugin.dll rename respectively and are made into copy and are stored under the identical directory A, for example are renamed as tmpc0.lib respectively; Tmpc0.dll; Net_plugin0.dll and Mp4plugin0.dll, because originally writing to be decided to be, the code among the tmpc0.dll loaded Net_plugin.dll and Mp4plugin.dl, therefore also need the program of manual modification tmpc0.dll for loading Net_plugin0.dll and Mp4plugin0.dll, recompilate, when monitor call core player storehouse, the program of tmpc0.dll is for could successfully load Net_plugin0.dll and Mp4plugin0.dll, above process bothers very much, normally the programmer finishes, common cellphone subscriber generally can not finish, this makes the cellphone subscriber after an application program is installed, and an application program of using identical player storehouse is installed again brings very big puzzlement.
Given this, be necessary to propose a kind of improved method to overcome the defective of prior art in fact.
Summary of the invention
Technical matters to be solved by this invention is to overcome in the prior art as same DLL, is used for different application programs, and the programmer needs will the phase change UID by hand, and the filename of change DLL, defective such as to avoid conflict.
For solving the problems of the technologies described above, the invention provides the chained library Compilation Method of a kind of UID of obtaining, these method concrete steps are as follows:
Step S1: first application program is installed at described portable terminal, described first application program comprises first chained library, first application program is obtained a UID automatically, the one UID and first links library name combination and new library name first chained library of called after, and when mounted new library name first chained library is stored under the assigned catalogue of portable terminal internal memory;
Step S2: at described portable terminal second application program is installed, described second application program comprises second chained library;
Step S3: after described second application program was obtained the 2nd UID automatically, the 2nd UID and second linked library name combination and new library name second chained library of called after, and new library name second chained library is stored under the described designated directory;
Step S4: the described second application program installation, new library name first chained library is stored under the described same assigned catalogue with new library name second chained library, and when starting first application program respectively, first application program will be called new library name first chained library; When starting second application program, will call new library name second chained library.
Beneficial effect of the present invention is, adopt the present invention, application program provider can be packaged into core technology a series of chained libraries, chained library comprises static library LIB and dynamic base DLL, and this DLL can be applied in the different application programs, when these application are installed on same the mobile phone, problems such as the filename conflict that often occurs before can not occurring, loading failure.
Embodiment
Illustrate that below in conjunction with accompanying drawing the present invention specifically implements.
The inventive method is applicable to portable terminal, and portable terminal is the smart mobile phone with Sybiam operating system, and the User Identity of described UID for being provided by Sybiam operating system provider please refer to and Figure 1 shows that the inventive method process flow diagram.
Step S1: first application program is installed at described portable terminal, described first application program comprises first chained library, first application program is obtained a UID automatically, the one UID and first links library name combination and new library name first chained library of called after, and when mounted new library name first chained library is stored under the assigned catalogue of portable terminal internal memory; First chained library and second chained library are the core player storehouse of first application program and second application program, static link library and dynamic link library have been included, wherein first chained library is distinguished called after first static link library and first dynamic link library, first dynamic link library comprises first leading dynamic base and the first subordinate dynamic base, second chained library is called after second static link library and second dynamic link library respectively, described second dynamic link library comprises second leading dynamic base and the second subordinate dynamic base, and step S1 is specific as follows:
Step S11: with UID and the combination of first static link library, and new library name first static link library of called after;
Step S12: with UID and the first leading dynamic base and the combination of the first subordinate dynamic base, and the new library name first leading dynamic base of called after and the new library name first subordinate dynamic base;
Step S13: the new library name first leading dynamic base compiles the new library name first subordinate dynamic base of loading automatically.
Step S2: at described portable terminal second application program is installed, described second application program comprises second chained library;
Step S3: after described second chained library obtains UID automatically, UID and second is linked library name combination and new library name second chained library of called after, and new library name second chained library is stored under the described designated directory;
Please be simultaneously with reference to Fig. 2, step S3 is specific as follows:
Step S31: with UID and the combination of second static link library, and new library name second static link library of called after;
Step S32: with UID and the second leading dynamic base and the combination of the second subordinate dynamic base, and the new library name second leading dynamic base of called after and the new library name second subordinate dynamic base;
Step S33: the new library name second leading dynamic base compiles the new library name second subordinate dynamic base of loading automatically.
Step S4: the described second application program installation, new library name first chained library is stored under the described same assigned catalogue with new library name second chained library, and when starting first application program respectively, first application program will be called new library name first chained library; When starting second application program, will call new library name second chained library, step S4 is specific as follows:
Step S41: when starting first application program, first application program will be called new library name first static link library and first dynamic link library of new library name first chained library, and wherein, the new library name first leading dynamic base will load the new library name first subordinate dynamic base;
Step S42: when starting second application program, second application program will be called new library name second static link library and second dynamic link library of new library name second chained library, and wherein, the new library name second leading dynamic base will load the new library name second subordinate dynamic base.
Pass through the inventive method, as also need be when portable terminal be installed the three or more application program, same correspondence has the 3rd chained library or more chained libraries, to use new UID and the 3rd chained library or more chained libraries to make up and with the 3rd chained library or new library name the 3rd chained library of more chained library called afters or more chained libraries, and with new library name the 3rd chained library or more multichain connect under the assigned catalogue that the stock is stored in the portable terminal internal memory.
Further specify this method below in conjunction with an instantiation.
Mobile phone business service provider's product line can get more and more, the mobile phone TV services that for example develop and monitoring mobile phone business, mobile phone TV services and monitoring mobile phone business be each self-contained core player storehouse all, mobile phone TV services and monitoring mobile phone business can be mounted on the mobile phone in no particular order, set herein mobile phone TV services are installed earlier, the mobile TV program of finishing exploitation comprises a core player storehouse, as shown in table 1 below, the core player storehouse comprises a static link library and three dynamic link libraries, title is respectively Tmpc.lib, Tmpc.dll, Net_plugin.dll and Mp4_plugin.dll, wherein, Tmpc.dll takes dynamic base as the leading factor, Net_plugin.dll and Mp4_plugin.dll are the subordinate dynamic base, when the mobile TV program is installed to mobile phone, the mobile TV program is at first obtained a UID, UID is the Symbian application software that operates on the mobile phones such as Nokia herein, it is a very important resource, in order to distinguish different should program or dynamic base, UID is distributed by Symbian company, the UID that for example herein obtains is 0x12345678, respectively static library name is changed to Tmpc0x12345678.lib according to the UID that obtains, Tmpc0x12345678.dll, Net_plugin0x12345678.dll and Mp4_plugin0x12345678.dll, because when the mobile TV program start calls the core player storehouse, leading dynamic base Tmpc0x12345678.dll will load subordinate dynamic base Net_plugin0x12345678.dll and Mp4_plugin0x12345678.dll, therefore, leading dynamic base Tmpc0x12345678.dll finishes the subordinate dynamic base name that needs to load in its code of compiling automatically and is called: Net_plugin0x12345678.dll and Mp4_plugin0x12345678.dll are stored in the core player stock under the assigned catalogue of mobile phone EMS memory at last.
The former library name in table 1 mobile TV core player storehouse and the new library name table of comparisons
Then the monitoring mobile phone program is mounted to the mobile phone end, the mobile TV program of finishing exploitation also comprises a core player storehouse, as shown in table 2 below, the core player storehouse comprises a static link library and three dynamic link libraries, title is respectively Tmpc.lib, Tmpc.dll, Net_plugin.dll and Mp4_plugin.dll, wherein, Tmpc.dll takes dynamic base as the leading factor, Net_plugin.dll and Mp4_plugin.dll are the subordinate dynamic base, equally, when the monitoring mobile phone program is installed to mobile phone, the monitoring mobile phone program is at first obtained another UID, the UID that for example herein obtains is 0x0x87654321, respectively static library name is changed to Tmpc0x0x87654321.lib according to the UID that obtains, Tmpc0x0x87654321.dll, Net_plugin0x0x87654321.dll and Mp4_plugin0x0x87654321.dll, because when the mobile TV program start calls the core player storehouse, leading dynamic base Tmpc0x0x87654321.dll will load subordinate dynamic base Net_plugin0x0x87654321.dll and Mp4_plugin0x0x87654321.dll, therefore, leading dynamic base Tmpc0x0x87654321.dll finishes the subordinate dynamic base name that needs to load in its code of compiling automatically and is called: Net_plugin0x87654321.dll and Mp4_plugin0x0x87654321.dll, at last the core player stock is stored under the assigned catalogue of mobile phone EMS memory, the catalogue of the core player of this assigned catalogue and mobile TV storage is same assigned catalogue.
The former library name in table 2 monitoring mobile phone core player storehouse and the new library name table of comparisons
Former library name |
New library name (UID is sexadecimal) |
Tmpc.lib |
Tmpc0x87654321.lib |
Tmpc.dll |
Tmpc0x87654321.dll |
Net_plugin.dll |
Net_plugin0x87654321.dll |
Mp4_plugin.dll |
Mp4_plugin0x87654321.dll |
Below be that application program is obtained UID and UID and chained library are made up one section program naming to chained library again:
The application program of mobile phone that above mobile TV and monitoring mobile phone provide for same service provider, also can be provided by different providers, described first application program is by the different application program of service provider with second application program in addition, it also can be the different editions of same program, different editions, first version and second version that for example can mobile phone TV services.
The above only is preferred embodiment of the present invention, not in order to limiting the present invention, all any modifications of doing within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.