CN100530108C - Method and system for calling function - Google Patents

Method and system for calling function Download PDF

Info

Publication number
CN100530108C
CN100530108C CNB2007100869182A CN200710086918A CN100530108C CN 100530108 C CN100530108 C CN 100530108C CN B2007100869182 A CNB2007100869182 A CN B2007100869182A CN 200710086918 A CN200710086918 A CN 200710086918A CN 100530108 C CN100530108 C CN 100530108C
Authority
CN
China
Prior art keywords
function
call
plan
dynamic base
resource pool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB2007100869182A
Other languages
Chinese (zh)
Other versions
CN101271402A (en
Inventor
张宇
李建斌
徐志贤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CNB2007100869182A priority Critical patent/CN100530108C/en
Priority to PCT/CN2008/070491 priority patent/WO2008113291A1/en
Publication of CN101271402A publication Critical patent/CN101271402A/en
Application granted granted Critical
Publication of CN100530108C publication Critical patent/CN100530108C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Abstract

The invention discloses a function calling method, including configuration of a function calling plan for loading all functions in a function dynamic base to a function resource pool; and loading of a major control unit to get the function calling plan for calling and executing the function from the function resource pool according to the calling plan. As the user is responsible for the configuration of the calling plan, whether the dynamic base function is called or not and how to call the dynamic base function are controlled according to the need of the user. In addition, all functions of the function dynamic base are loaded to the function resource pool in start-up, thus avoiding the performance consumption for obtaining function handle by dynamically starting the function dynamic base when calling the function in the operation period and then enhancing the performance of the operation period. The invention further discloses a function calling system.

Description

A kind of method and system of call function
Technical field
The present invention relates to the software development technique field, particularly a kind of method and system of call function.
Background technology
In the at present big project exploitation, way is by functional module division of labor exploitation usually, provides the power function storehouse to call to upper level applications at last, forms a complete system.
The file that has comprised the object code of a lot of functions and variable is called as " storehouse ", and the storehouse is divided into static library and dynamic base at present.
Static library: it is relatively simple for structure, be that all object codes are put together, chain program is searched corresponding symbol (function and name of variables) according to the symbol table of each part object code during link, if finding the symbol that then this function the inside is needed to locate positions, put the monoblock function code into executable file then, withdraw from if can not find then to report an error.
When using static library, need the code of call function because the executable file that the link back produces has comprised all, it is bigger therefore to take disk space; And, if a plurality of process operations simultaneously in internal memory of calling the same bank function are arranged, then just have many parts of identical built-in function codes in the internal memory, so the committed memory space is many; Static library all need recompilate once changing all function modules that call this static library.
Dynamic base: it is introduced for the problem that solves static library produces, and its load mode has following two kinds:
A) static binding
The program of using static binding when being written into internal memory at the beginning, primary control program will be program the address of all dynamic codes that call calculate, decide, when also promptly starting with the function that might use be loaded into internal memory.This mode makes the initialization of calling program long, but after the initialization success, the travelling speed of program is than very fast.
B) dynamic binding
Make program in this way not finish dynamic link, but when really calling the dynamic base code, primary control program just calculate the logical address of dynamic code at the very start.
The present the most frequently used dynamic binding mode that is to use dynamic base is because it can realize the dirigibility of calling.Promptly open dynamic base with dlopen () function, and the functional symbol that accesses in the dynamic base with dlsym () function uses, finish using and then close dynamic base with dlclose () function at the place of calling.With under the Unix environment, need call test () function is that example describes below, and referring to Fig. 1, it is the existing schematic flow sheet of using the mode call function of dynamic binding.
Step 101 loads primary control program.
Step 102 is obtained the handle A that calls the libtest.so dynamic base by dlopen () function.
Step 103 according to handle A and test () function name to be called, is obtained the handle B of test () function correspondence with dlsym () function.
Step 104 is carried out test () function according to handle B, calls dlclose () function after being finished and closes this handle.
So far, the test () function calls under the realization dynamic binding mode.
Though the Dynamic Binding Technology of dynamic base has realized calling flexibly of dynamic base function, in implementation procedure, the inventor finds that there are the following problems at least:
1) function calls and uncontrollable for the user can not be changed because function calls all has cured in the code of primary control program.
2) owing to when calling the dynamic base function, need call dlopen (), dlSym functions such as () obtains the function handle in the dynamic base, and this all relatively consumes performance in operational process, so dynamic binding makes its runtime performance lower.
3) can't support user's secondary development, this be because, from last example test () function place dynamic base as can be seen, and function parameters information must all be known, and has cured in the code of primary control program and just can be called, if the user wants to call the newTest () function of its oneself exploitation in primary control program, just must revise primary control program, and recompilate the executive routine of its primary control program, and the issue redaction, this is unpractical for the developer.
Summary of the invention
The embodiment of the invention provides a kind of method and system of call function, makes to control whether call the dynamic base function according to user's demand, and improves the performance of runtime.
The technical scheme of the embodiment of the invention comprises:
The plan of calling of a kind of method of call function, configuration function is also preserved, and this method is further comprising the steps of:
Functions all in the function dynamic base is loaded into the function resource pool;
Obtain described function call plan, also carry out according to the described plan call function from described function resource pool that calls.
A kind of system of call function comprises:
The function dynamic base, be used to store the function that remains to be called;
Dispensing unit is used for configuration function plan of calling and preservation;
First loading unit is used for all functions of function dynamic base are loaded into the function resource pool;
The function resource pool is used to preserve the function that is loaded;
Main control unit is used to call described function call plan, also carries out according to the described plan call function from described function resource pool that calls.
Use the embodiment of the invention, because the plan of calling is by user configured, thereby can control whether call the dynamic base function according to user's demand, and how to call or the like, have again, owing to when starting all functions in the function dynamic base all are loaded into the function resource pool, dynamically open the performance cost of function dynamic base when having avoided in the runtime call function, thereby improved the performance of runtime.
Description of drawings
Fig. 1 is the existing schematic flow sheet of using the mode call function of dynamic binding;
Fig. 2 is the schematic flow sheet according to the call function of the embodiment of the invention;
Fig. 3 is the schematic flow sheet of the plan of calling according to the configuration function of the embodiment of the invention;
Fig. 4 is the schematic flow sheet open according to the realization secondary of the embodiment of the invention;
Fig. 5 is the system architecture synoptic diagram according to the call function of the embodiment of the invention.
Embodiment
Below in conjunction with drawings and the specific embodiments the present invention is elaborated again.
Figure 2 shows that according to the schematic flow sheet of the call function of the embodiment of the invention, specifically comprise:
Step 201 is by plan of calling of configuration interface configuration function and preservation.Configuration in this step is carried out by the user, so just can call condition according to user's demand setting and control whether call the dynamic base function, and call which function or the like.
Step 202 is loaded into the function resource pool with all functions in the function dynamic base during startup.The function that is loaded in the described function resource pool can exist with the form of function handle, also can exist with other forms, the form that exists is not limited herein.
Step 203, loading main control unit is primary control program, obtains user configured described function call plan by main control unit.
Step 204 is called respective function and execution according to the function call plan from the function resource pool.
Above-mentioned configuration function calls the detailed process of plan can be referring to Fig. 3,
Step 301, configuration is used to indicate the regular expression that when needs the call function dynamic base; With of the function call plan of this regular expression as configuration;
Step 302 compiles above-mentioned expression formula by regulation engine;
The compiling string that step 303, create-rule engine can be discerned should compile string and be kept in the database.
Being appreciated that the database of this preservation compiling string and the function dynamic base of above-mentioned all functions of preservation, can be an entity physically, logically can be two databases.
Accordingly, the process of the acquisition function call plan in the above-mentioned steps 203 comprises: obtain regulation engine and can compile string and execution from described database, obtain the function call plan according to described compiling string.
Like this, because the plan of calling is by user configured, thereby can control whether call the dynamic base function according to user's demand, and how to call or the like, have again, owing to when starting all functions in the function dynamic base all are loaded into the function resource pool, dynamically open the function dynamic base when having avoided in the runtime call function obtaining the performance cost of function handle, thereby improved the performance of runtime.
In addition, the embodiment of the invention also provides the function of secondary development, promptly after system's issue, if the user proposes new functional requirement, can pass through SDK (Software Development Kit) (SDK, SoftwareDevelopment Kit) bag and carry out the secondary development of power function, and need not issue new system or provide patch to system, thereby the system that makes has favorable expansibility, and is very little to the original system influence.Referring to Fig. 4, it is the schematic flow sheet according to the realization secondary development of the embodiment of the invention.Be specially:
Step 401 is developed new power function according to demand, and during practical application, the SDK bag that can utilize open merchant to provide is developed.
Step 402 is registered to the essential information of described new power function in the described function dynamic base.The essential information of described new power function comprises: function name, affiliated dynamic library name, described dynamic base path, function parameters number and parameter type.
Like this, when system start-up, this new power function just can be loaded in the function resource pool, in order to subsequent applications.
Step 403, the plan of calling of disposing described new power function in described function call in the works.Because the function call plan is by user configured, thereby, can add according to user's demand and need call certain function how to call or the like.The concrete configuration process can be referring to Fig. 3, no longer repeat specification.
Step 404, loading main control unit is primary control program, obtains described function call plan.
Step 405 is called respective function and execution according to the plan of calling from the function resource pool.
So far, realized function calls newly developed.And this calls is that need not to revise main control unit be primary control program.
One of ordinary skill in the art will appreciate that, realize that all or part of step in the foregoing description method is to instruct relevant hardware to finish by program, described program can be stored in the computer-readable recording medium, described storage medium such as ROM/RAM, disk, CD etc.
The embodiment of the invention also discloses a kind of system of call function, comprising:
Function dynamic base 510, be used to store the function that remains to be called;
Dispensing unit 550 is used for configuration function plan of calling and preservation; This concrete configuration process can be referring to Fig. 3 of front;
First loading unit 520 is used for when starting all functions of function dynamic base are loaded into the function resource pool;
Function resource pool 530 is used to preserve the function that is loaded; The function that is loaded that described function resource pool is preserved can exist with the form of function handle, also can exist with other forms, the form that exists is not limited herein;
Main control unit 540 is used to call described function call plan, also carries out according to the described plan call function from described function resource pool that calls.
This system can also comprise: development block 560, be used to dispose new power function, and the essential information of described new power function is registered in the described function dynamic base, described new power function obtains according to the user's request exploitation.The essential information of described new power function comprises: function name, affiliated dynamic library name, described dynamic base path, function parameters number and parameter type.
Said system can also comprise second loading unit (figure does not show), and being used at first loading main control unit after system start-up is primary control program, and main control unit is carried out subsequent treatment more afterwards.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.All any modifications of being done within the spirit and principles in the present invention, be equal to replacement, improvement etc., all be included in protection scope of the present invention.

Claims (10)

1, a kind of method of call function is characterized in that, the configuration function plan of calling is also preserved, and this method is further comprising the steps of:
Functions all in the function dynamic base is loaded into the function resource pool;
Obtain described function call plan, also carry out according to the described plan call function from described function resource pool that calls.
2, method according to claim 1 is characterized in that,
The step that described configuration function calls plan comprises: how configuration is used to indicate the regular expression of call function dynamic base; With of the function call plan of described regular expression as configuration; Described expression formula is compiled, the compiling string that the create-rule engine can be discerned, and be kept in the database;
The process of described acquisition function call plan comprises: obtain regulation engine compiling string and execution from described database, obtain the function call plan according to described compiling string.
3, method according to claim 1 is characterized in that, further comprises:
Develop new power function according to demand, the essential information of described new power function is registered in the described function dynamic base; Dispose described new power function in the works in described function call.
4, method according to claim 3 is characterized in that, the exploitation of described new power function is finished by SDK (Software Development Kit).
5, method according to claim 3 is characterized in that, the essential information of described new power function comprises: function name, affiliated dynamic library name, described dynamic base path, function parameters number and parameter type.
6, method according to claim 1 is characterized in that, the function that is loaded in the described function resource pool exists with the form of function handle.
7, a kind of system of call function is characterized in that, comprising:
The function dynamic base, be used to store the function that remains to be called;
Dispensing unit is used for configuration function plan of calling and preservation;
First loading unit is used for all functions of function dynamic base are loaded into the function resource pool;
The function resource pool is used to preserve the function that is loaded;
Main control unit is used to call described function call plan, also carries out according to the described plan call function from described function resource pool that calls.
8, system according to claim 7 is characterized in that, this system also comprises:
Development block is used to dispose new power function, and the essential information of described new power function is registered in the described function dynamic base, and described new power function obtains according to the user's request exploitation.
9, system according to claim 8 is characterized in that, the essential information of described new power function comprises: function name, affiliated dynamic library name, described dynamic base path, function parameters number and parameter type.
10, system according to claim 7 is characterized in that, described function resource pool is preserved is loaded function and exists with the form of function handle.
CNB2007100869182A 2007-03-20 2007-03-20 Method and system for calling function Expired - Fee Related CN100530108C (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CNB2007100869182A CN100530108C (en) 2007-03-20 2007-03-20 Method and system for calling function
PCT/CN2008/070491 WO2008113291A1 (en) 2007-03-20 2008-03-13 Method and system for calling functions

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2007100869182A CN100530108C (en) 2007-03-20 2007-03-20 Method and system for calling function

Publications (2)

Publication Number Publication Date
CN101271402A CN101271402A (en) 2008-09-24
CN100530108C true CN100530108C (en) 2009-08-19

Family

ID=39765397

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2007100869182A Expired - Fee Related CN100530108C (en) 2007-03-20 2007-03-20 Method and system for calling function

Country Status (2)

Country Link
CN (1) CN100530108C (en)
WO (1) WO2008113291A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101441566B (en) * 2008-11-18 2012-04-25 腾讯科技(深圳)有限公司 Method for dynamically linking program on the Embedded type platform
CN101714075B (en) * 2009-12-17 2012-12-19 深圳市万兴软件有限公司 Function calling method and device
CN101706737B (en) * 2009-12-18 2012-10-03 湖南大学 Method for constructing synergic function library of software and hardware
CN103927191B (en) * 2013-01-11 2017-05-24 北京阿里巴巴云计算技术有限公司 Resource allocation method and resource allocation device for invoking function
CN105677550A (en) * 2015-12-29 2016-06-15 广州华多网络科技有限公司 Performance acquisition-analysis method, device and system based on Linux system
CN107357553A (en) * 2017-07-11 2017-11-17 郑州云海信息技术有限公司 A kind of data capture management method and device
CN110362356B (en) * 2018-04-09 2022-06-24 腾讯科技(深圳)有限公司 Function data processing method and device, computer equipment and storage medium
CN109739576B (en) * 2018-12-29 2022-03-25 杭州迪普科技股份有限公司 Configuration overview command execution method and device, computer equipment and storage medium thereof
CN111459489B (en) * 2020-02-27 2023-09-26 湖南大学 Automatic service packaging method, system and application of dynamic library

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7536683B2 (en) * 1999-01-15 2009-05-19 Adobe Systems Incorporated Method of dynamically appending a library to an actively running program
JP2006113935A (en) * 2004-10-18 2006-04-27 Hitachi Ltd Dynamic link library calling code generation method, program, and apparatus
JP2007164595A (en) * 2005-12-15 2007-06-28 Toshiba Corp Function calling method of computer system, computer system and library

Also Published As

Publication number Publication date
WO2008113291A1 (en) 2008-09-25
CN101271402A (en) 2008-09-24

Similar Documents

Publication Publication Date Title
CN100530108C (en) Method and system for calling function
CN111770113B (en) Method for executing intelligent contract, block chain node and node equipment
US10089119B2 (en) API namespace virtualization
CN101697131B (en) Method and device for dynamically loading relocatable file
US9519466B2 (en) Executable code for constrained computing environments
CN111399990B (en) Method and device for interpreting and executing intelligent contract instruction
JP2005509194A (en) Method and apparatus for creating and using pre-internalized program files
US20110289480A1 (en) Method and apparatus for application building using build styles
CN111815310B (en) Method for executing intelligent contract, block chain node and storage medium
US5835773A (en) Method for achieving native performance across a set of incompatible architectures using a single binary file
CN104731622A (en) Application program loading method and device and mobile terminal
CN110659088B (en) Method and system for expanding program under embedded environment
CN101334737A (en) Embedded equipment start-up or reset method
CN111770204A (en) Method for executing intelligent contract, block chain node and storage medium
CN111768183A (en) Method for executing intelligent contract, block chain node and storage medium
CN111768184A (en) Method for executing intelligent contract and block link point
CN100549958C (en) A kind of class file stowage and system
CN100465894C (en) Class loading method for starting Java Processor
CN113220327B (en) Intelligent contract upgrading method and block chain system
CN111770202B (en) Method for executing intelligent contract, block chain node and storage medium
KR101140522B1 (en) System and Method for Managing Object
KR100727627B1 (en) Method for supporting application using dynamic linking library and system using the method
JP3682050B2 (en) Embedded software development equipment
KR20050010640A (en) Dynamic Linking Method for Application Program
Vermeir MAUI

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090819

Termination date: 20140320