CN114416219B - System function calling method, device, electronic equipment and readable medium - Google Patents

System function calling method, device, electronic equipment and readable medium Download PDF

Info

Publication number
CN114416219B
CN114416219B CN202111678012.6A CN202111678012A CN114416219B CN 114416219 B CN114416219 B CN 114416219B CN 202111678012 A CN202111678012 A CN 202111678012A CN 114416219 B CN114416219 B CN 114416219B
Authority
CN
China
Prior art keywords
function
springboard
dynamic link
application program
link library
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.)
Active
Application number
CN202111678012.6A
Other languages
Chinese (zh)
Other versions
CN114416219A (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.)
Beijing 58 Information Technology Co Ltd
Original Assignee
Beijing 58 Information Technology 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 Beijing 58 Information Technology Co Ltd filed Critical Beijing 58 Information Technology Co Ltd
Priority to CN202111678012.6A priority Critical patent/CN114416219B/en
Publication of CN114416219A publication Critical patent/CN114416219A/en
Application granted granted Critical
Publication of CN114416219B publication Critical patent/CN114416219B/en
Active 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/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides a system function calling method, a device, electronic equipment and a readable medium, wherein the method comprises the following steps: when a current function is called in an application program, a dynamic link library of the application program is called; the dynamic link library comprises a springboard function, wherein the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library; if the dynamic link library contains the target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address; and calling the target springboard function after the system function is called in the application program. When the system function is required to be called in the application program, the embodiment of the invention indirectly calls the system function through the springboard function in the dynamic link library, thereby improving the calling efficiency of the system function.

Description

System function calling method, device, electronic equipment and readable medium
Technical Field
Embodiments of the present invention relate to the field of computer technologies, and in particular, to a system function calling method, a system function calling device, an electronic device, and a computer readable medium.
Background
The system library packages and stores some functions as system functions for the user to call correspondingly. The development of applications (App) requires reliance on a system library, and applications often require access to the system library to make system function calls.
At present, the call of the system function in the system library is realized, and the bind information (the bind is a resource pointer outside the directed mirror image) in the data segment needs to be dynamically modified when the application program runs, so that the application program can call the required system function based on the modified bind information. However, if the application is a large application, the corresponding bind information is also more, so that it is time-consuming to find and modify the bind information in the application, resulting in low call efficiency of the system function.
Disclosure of Invention
The embodiment of the invention provides a system function calling method, a device, electronic equipment and a computer readable storage medium, which are used for solving the problem of low system function calling efficiency.
The embodiment of the invention discloses a system function calling method, which comprises the following steps:
when a current function is called in an application program, a dynamic link library of the application program is called; the dynamic link library comprises a springboard function, wherein the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
if the dynamic link library contains the target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address;
and calling the target springboard function after the system function is called in the application program.
Optionally, before the calling of the current function in the application program, the method further includes:
setting an overlay system function in an executable file of an application program; the coverage system function and the system function in the system library have the same function identification and function attribute parameters;
adding a springboard function corresponding to the coverage system function into a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, the function attribute parameters are the same, and the springboard function is provided with the function address of the system function.
Optionally, if the dynamic link library includes a target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address, including:
and if the dynamic link library contains the function identifier of the target springboard function corresponding to the function identifier of the current function, the target springboard function calls the system function in the dynamic link library through the function address.
Optionally, after the calling the dynamic link library of the application program, the method further comprises:
and if the dynamic link library contains the target function to be called corresponding to the current function, calling the target function to be called.
Optionally, if the dynamic link library includes a target function to be called corresponding to the current function, the calling the target function to be called includes:
and if the function identifier of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library, calling the function to be called.
Optionally, the system function includes a C function library C function.
The embodiment of the invention also discloses a system function calling device, which comprises:
the current function calling module is used for calling the dynamic link library of the application program when the current function is called in the application program; the dynamic link library comprises a springboard function, wherein the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
a system function calling module, configured to call, if the dynamic link library includes a target springboard function corresponding to the current function, the target springboard function through the function address in the dynamic link library;
and the springboard function calling module is used for calling the target springboard function after the system function is called in the application program.
Optionally, the apparatus further comprises: the springboard function setting module is used for setting an overlay system function in an executable file of the application program; the coverage system function and the system function in the system library have the same function identification and function attribute parameters; adding a springboard function corresponding to the coverage system function into a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, the function attribute parameters are the same, and the springboard function is provided with the function address of the system function.
Optionally, the system function calling module is configured to call the system function in the dynamic link library through the function address if the dynamic link library includes a function identifier of a target springboard function corresponding to the function identifier of the current function.
Optionally, the apparatus further comprises: and the function to be called calling module is used for calling the target function to be called corresponding to the current function if the target function to be called corresponding to the current function is contained in the dynamic link library.
Optionally, the function to be called calling module is configured to call the function to be called if a function identifier of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library.
The embodiment of the invention also discloses electronic equipment, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method according to the embodiment of the present invention when executing the program stored in the memory.
Embodiments of the invention also disclose one or more computer-readable media having instructions stored thereon, which when executed by one or more processors, cause the processors to perform the methods described in the embodiments of the invention.
The embodiment of the invention also discloses a computer program product which is stored in a storage medium and is executed by at least one processor to realize the method according to the embodiment of the invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, the springboard function is set in the dynamic link library of the application program, wherein the function address of the springboard function is the function address of the system function, when the current function is called in the application program, if the dynamic link library contains the target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address, and then the target springboard function after calling the system function can be called in the application program. When the system function is required to be called in the application program, the embodiment of the invention indirectly calls the system function through the springboard function in the dynamic link library, and the system function is not directly called in the application program, so that bind information in the application program is not required to be searched and modified, and the calling efficiency of the system function is improved.
Drawings
FIG. 1 is a flow chart of steps of a system function call method provided in an embodiment of the present invention;
FIG. 2 is a block diagram of a system implementing a system function call provided in an embodiment of the present invention;
FIG. 3 is a flow chart for implementing system function indirection calls in an application provided in an embodiment of the invention;
fig. 4 is a block diagram of a system function calling device according to an embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
First, some technical terms involved in the embodiments of the present invention will be described:
hook: the hooking technique is a technique that can replace a function of an application program with one of other functions to be executed, and the function of execution logic of the function of the application program can be modified by using the hooking technique.
AOP: in the software industry, AOP refers to Aspect Oriented Programming, meaning: a technique for realizing unified maintenance of program functions by a precompiled mode and dynamic agents during running is oriented to tangent plane programming. AOP is a continuation of OOP (Object Oriented Programming, object-oriented programming), a hotspot in software development, an important content in Spring framework, and a derivative model of functional programming.
Dynamic library: also known as a Dynamic link Library (Dynamic Link Library or Dynamic link Library, abbreviated as DLL), is one way to implement the concept of shared function libraries in an operating system. Dynamic linking provides a way for an application to call a function that does not belong to its executable code.
bind: when the system is dynamically linked, bind points to a resource pointer outside the mirror.
At present, the technical scheme for realizing the call to the system function in the application program comprises the following steps:
technical scheme 1: in iOS systems, the current common solution for invoking system functions is the fisheok solution. Specifically, the fisheok scheme enables the invocation of system functions by dynamically modifying bind information in the data segment of the application while the application is running.
The drawbacks of the above-mentioned claim 1 include: in a large-sized application program, since bind information is relatively large, it takes a lot of time to call a system function, for example, it takes up to 50ms on the iPhone 11 when the system function is called by using the fishek scheme for a large-sized application program capable of providing various services such as network shopping, network house finding, network work finding, etc.
Technical scheme 2: after compiling an executable file (binary file) of the application program is completed, directly modifying bind information in the binary file, and replacing a system function to be called with a function of the application program written by a developer.
The drawbacks of the above-mentioned claim 2 include: 1) The binary file of the application program needs to be modified and re-signed, the development cost is high, and the assumption that 100 system functions are required to be called means that the bind information at 100 positions in the binary file needs to be modified, the maintenance cost is too high, and additional script flows need to be added.
In order to solve the above problems, according to the system function calling method provided by the embodiment of the invention, the system function is called by using the custom dynamic link library as an intermediate springboard through the dynamic link library of the custom application program. Specifically, the principle of the embodiment of the invention is as follows: defining a system function to be called in an application program to intercept all the calls of the system function in the application program, calling the system function to be called by the application program in a dynamic link library by means of the isolation of the dynamic link library, and calling the springboard function of the system function in the dynamic link library in the application program to realize the section-oriented programming behavior.
Referring to fig. 1, a flowchart illustrating steps of a system function calling method provided in an embodiment of the present invention may specifically include the following steps:
102, when a current function is called in an application program, a dynamic link library of the application program is called; the dynamic link library comprises a springboard function, wherein the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library.
In a specific implementation, the dynamic link library contains codes and other resources and the like necessary for the running of the application program, and the dynamic link library is a library which needs to be loaded when the application program runs, and can be used for normally running the application program after the dynamic link library is correctly installed.
In the embodiment of the invention, the coverage system function corresponding to the system function is set in the application program, and the springboard function capable of indirectly calling the system function is added in the dynamic link library of the application program, wherein the springboard function corresponds to the coverage system function, so that if the current system function is the coverage system function, the calling of the system function can be realized through the corresponding springboard function.
The overlay system function is a function which is customized by a developer in an application program and is the same as the system function, and the springboard function in the dynamic link library is a function which is customized by the developer and is the same as other information except the function identification of the system function.
As a specific example of the present invention, the system function may refer to a C function in a C function library, for example, NSLog is a C function in a C function library, and assuming that a function desired to be called in an application program is NSLog, an overlay system function may be customized in an executable file of the application program, where the customized overlay system function is the same as NSLog of the system library. Accordingly, in the dynamic link library of the application program, a function which is the same as the NSLog except for the function identifier is added as the springboard function, for example, the function identifier of the springboard function may be "my_nslog" and is different from the function identifier "NSLog" of the system function NSLog.
In a specific implementation, function call is performed in the running process of the application program, if the current function called in the application program is an overlay system function, a dynamic link library of the application program can be called, and then the system function is indirectly called through a springboard function of the dynamic link library.
Step 104, if the dynamic link library contains the target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address.
And step 106, calling the target springboard function after the system function is called in the application program.
In the embodiment of the invention, if the target springboard function corresponding to the current function is contained in the dynamic link library, the springboard function can be used as the target springboard function corresponding to the current function, then the corresponding system function in the system library can be called based on the function address corresponding to the target springboard function in the dynamic link library, and then the target springboard function with the system function is called in the application program. For example, assuming that the overlay system function NSLog in the application program corresponds to the springboard function my_nslog in the dynamic link library, when the overlay system function NSLog is called in the application program, the system function NSLog in the system library is called based on the springboard function my_nslog in the dynamic link library through the corresponding function address, and then the application program calls the springboard function my_nslog that has called the system function NSLog, thereby realizing the indirect call of the system function NSLog by the application program.
It should be noted that, the dynamic link library and the application program are independent compiling links, so that the application program and the dynamic link library have isolation, so that the springboard function in the dynamic link library calls the system function which the application program wants to call, and then calls the springboard function of the system function in the dynamic link library in the application program, and the bind information in the application program can be not modified.
In the method for calling the system function, the springboard function is set in the dynamic link library of the application program, wherein the function address of the springboard function is the function address of the system function, when the current function is called in the application program, if the dynamic link library contains the target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address, and then the target springboard function after the system function is called in the application program. When the system function is required to be called in the application program, the embodiment of the invention indirectly calls the system function through the springboard function in the dynamic link library, and the system function is not directly called in the application program, so that bind information in the application program is not required to be searched and modified, and the calling efficiency of the system function is improved.
On the basis of the above embodiments, modified embodiments of the above embodiments are proposed, and it is to be noted here that only the differences from the above embodiments are described in the modified embodiments for the sake of brevity of description.
In an exemplary embodiment, before the step 102 of calling the current function in the application program and calling the dynamic link library of the application program, the method may further include the steps of:
setting an overlay system function in an executable file of an application program; the coverage system function and the system function in the system library have the same function identification and function attribute parameters;
adding a springboard function corresponding to the coverage system function into a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, the function attribute parameters are the same, and the springboard function is provided with the function address of the system function.
In a specific implementation, the function may have a corresponding function identifier and a function attribute parameter, where the function identifier refers to a function name, such as "NSLog", "my_nslog", and so on, and the function attribute parameter may include a function parameter and a return value, and so on.
The system function is a function which is defined by a developer in an application program and has the same function identification and function attribute parameters as the system function, and the springboard function in the dynamic link library is a function which is defined by the developer and has different function identification and function attribute parameters from the system function. In brief, the overlay system function and the system function are functions of the same-name same-parameter return values, and the springboard function and the system function are functions of different-name same-parameter return values. Specifically, the functions may correspond to each other by function name (symbol).
As a specific example of the present invention, assuming that a system library includes a system function NSLog, which is defined as void NSLog (nsstring×format), and assuming that a system function desired to be invoked in an application is NSLog, an overlay system function may be customized in an executable file of the application, where the customized overlay system function is the same as the NSLog of the system library and is void NSLog (nsstring×format). Accordingly, in the dynamic link library of the application program, a function identical to the NSLog except for the function identifier is added as a springboard function, for example, the springboard function may be defined as void my_nslog (NSString format), where the springboard function my_nslog corresponds to the overlay system function NSLog.
In the above-described exemplary embodiment, the same overlay system function as the system function is defined in the application program, and the springboard function corresponding to the overlay system function and identical to the system function except the function identification is defined in the dynamic link library of the application program, so that when the current function called by the application program is the overlay system function, the system function can be called indirectly through the springboard function in the dynamic link library.
In an exemplary embodiment, if the dynamic link library includes the target springboard function corresponding to the current function, the target springboard function calls the system function in the dynamic link library through the function address in the step 104, which may include the following steps:
and if the dynamic link library contains the function identifier of the target springboard function corresponding to the function identifier of the current function, the target springboard function calls the system function in the dynamic link library through the function address.
In the embodiment of the invention, when the coverage system function and the springboard function are defined, the function identification of the coverage system function and the function identification of the springboard function can be corresponding, so that whether the target springboard function corresponding to the current function called in the application program exists in the dynamic link library can be determined based on the function identification.
For example, assuming that the function identifier "my_nslog" of the springboard function corresponds to the function identifier "NSLog" of the overlay system function, the function identifier of the current function called in the application program is "NSLog", if the function identifier "my_nslog" of the target springboard function corresponding to the function identifier of the current function is included in the dynamic link library, it is explained that the current function is the overlay system function, the springboard function with the function identifier "my_nslog" may be used as the target springboard function, and thus the target springboard function may call the system function through the function address.
In the above exemplary embodiment, whether the target springboard function corresponding to the current function exists is quickly determined through the function identifier, so that the calling system function can be quickly realized in the application program, and the calling efficiency of the system function is improved.
In an exemplary embodiment, before the step 102 of calling the dynamic link library of the application program, the method may further include the steps of:
and if the dynamic link library contains the target function to be called corresponding to the current function, calling the target function to be called.
In a specific implementation, the executable file of the application program is obtained by compiling the source code of the executable file by a compiler and linking the source code by a linker. Specifically, a file generated after compiling the source code by the compiler is referred to as an object file, and includes program instructions and program data, which are stored in the form of segments (segments) having a certain length, respectively, the program instructions being stored in code segments, and the program data being stored in data segments. In addition, the target file may further include a dynamic link library, where the dynamic link library may include a function identifier and a function address corresponding to a function to be called, where the function to be called may be a function customized by a third party or a user. And after the linker links the target file generated by compiling, the final executable file can be obtained.
In the embodiment of the invention, when the application program calls the current function, if the dynamic link library contains the function to be called corresponding to the current function, the function to be called can be used as a target function to be called, and the target function to be called is called, so that the call of the application program to the target function to be called is realized.
In an exemplary embodiment, if the dynamic link library includes a target function to be called corresponding to the current function, the method may include the following steps:
and if the function identifier of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library, calling the function to be called.
In the embodiment of the invention, when the overlay function and the function to be called in the application program are defined, the function identification of the overlay function and the function identification of the function to be called can be corresponding, so that whether the function to be called corresponding to the current function called in the application program exists in the dynamic link library can be determined based on the function identification. For example, assuming that the function identifier "func2" of the function to be called corresponds to the function identifier "func1" of the function in the application program, the function identifier of the current function called in the application program is "func1", if the function identifier "func2" of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library, the function to be called with the function identifier "func2" may be called, so that the call to the function customized by the third party or the user is realized.
In the above exemplary embodiment, whether the function to be called corresponding to the current function exists in the dynamic link library is determined quickly through the function identifier, so that the function to be called can be called quickly in the application program, and the calling efficiency of the function to be called is improved.
In order to enable a person skilled in the art to better understand the procedure of indirect invocation of system functions by an application program, a complete example is described below.
Referring to fig. 2, a structural block diagram for implementing system function call provided in the embodiment of the present invention relates to an App executable file, a custom dynamic library, and a system library, where the App executable file mainly carries main function codes of an App; the custom dynamic link library comprises a springboard function set for realizing the calling of the system function. The functions to be invoked in the App are typically in a system library, such as a C function in the system library.
Referring to fig. 3, a flowchart for implementing system function call in an application program according to an embodiment of the present invention may specifically include the following steps:
1. the overlay system function of the same name and the same reference return value is defined in the App.
It is assumed that a system function NSLog in a system library needs to be called in an application program, where NSLog is a C function of the system library, and is defined as void NSLog (NSString format). In this step, an overlay system function is defined in App, and the function name is "NSLog", which is defined as the same as NSLog in the system library, and is void NSLog (NSString format).
2. And customizing the dynamic link library.
The step is to open the scheme and create a dynamic link library which can be normally accessed to the App.
3. Defining a springboard function with the same parameters as the different names of the coverage system functions in the App in a dynamic link library
And adding a springboard function with the same parameter as the NSLog synonym in the App and the return value into the dynamic link library, wherein the springboard function has the same information except for the difference of the function name and the NSLog in the App. Taking NSLog in APP as an example, a springboard function void my_nslog (NSString format) is created in the dynamic link library at this time, as long as the function names are different from those of NSLog in APP.
4. The springboard function in the dynamic link library calls the system function.
And calling NSLog in the system library in a springboard function void My_NSLog (NSString format), wherein the dynamic link library needs to independently compile links, and the bind information in the dynamic link library is recorded as a function address of the NSLog in the system library.
5. The jump board function calling the system function is called in the App.
In the coverage system function NSLog defined in App, the calling of the springboard function My_NSLog realizes the calling of NSLog in a system library. Because the App compiles the links independently, all places in the App that need to call NSLog in the system library are actually functions defined in the App, rather than directly calling the system functions.
By applying the embodiment of the invention, the mode of calling the system function is indirectly connected in the dynamic link library, so that the inefficient mode of searching and modifying the bind information in the App is avoided, and the calling efficiency of the system function is improved. In addition, the embodiment of the invention can modify the executable file of the application program without the help of scripts, and has lower maintenance cost.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 4, a block diagram of a system function calling device provided in an embodiment of the present invention is shown, which may specifically include the following modules:
a current function calling module 402, configured to call a dynamic link library of an application program when a current function is called in the application program; the dynamic link library comprises a springboard function, wherein the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
a system function calling module 404, configured to, if the dynamic link library includes a target springboard function corresponding to the current function, call the system function in the dynamic link library through the function address by using the target springboard function;
and the springboard function calling module 406 is configured to call the target springboard function after the system function is called in the application program.
In an exemplary embodiment, the apparatus further comprises: the springboard function setting module is used for setting an overlay system function in an executable file of the application program; the coverage system function and the system function in the system library have the same function identification and function attribute parameters; adding a springboard function corresponding to the coverage system function into a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, the function attribute parameters are the same, and the springboard function is provided with the function address of the system function.
In an exemplary embodiment, the system function calling module 404 is configured to call the system function in the dynamic link library through the function address if the function identifier of the target springboard function corresponding to the function identifier of the current function is included in the dynamic link library.
In an exemplary embodiment, the apparatus further comprises: and the function to be called calling module is used for calling the target function to be called corresponding to the current function if the target function to be called corresponding to the current function is contained in the dynamic link library.
In an exemplary embodiment, the function to be called calling module is configured to call the function to be called if a function identifier of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library.
In an exemplary embodiment, the system functions include a C-function library C-function.
In summary, in the embodiment of the present invention, a springboard function is set in a dynamic link library of an application program, where a function address of the springboard function is a function address of a system function, when a current function is called in the application program, if a target springboard function corresponding to the current function is included in the dynamic link library, the target springboard function calls the system function in the dynamic link library through the function address, and then, in the application program, the target springboard function after the system function is called can be called. When the system function is required to be called in the application program, the embodiment of the invention indirectly calls the system function through the springboard function in the dynamic link library, and the system function is not directly called in the application program, so that bind information in the application program is not required to be searched and modified, and the calling efficiency of the system function is improved.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Preferably, the embodiment of the present invention further provides an electronic device, including: the processor, the memory, store the computer program on the memory and can run on the processor, this computer program realizes each procedure of the above-mentioned system function call method embodiment when being carried out by the processor, and can reach the same technical result, in order to avoid repetition, will not be repeated here.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, realizes the processes of the system function calling method embodiment, and can achieve the same technical effects, and in order to avoid repetition, the description is omitted. Wherein the computer readable storage medium is selected from Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk.
Embodiments of the present invention provide a computer program product stored in a storage medium, where the program product is executed by at least one processor to implement the respective processes of the above method embodiments, and achieve the same technical effects, and for avoiding repetition, a detailed description is omitted herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
The foregoing is merely illustrative of the present invention, and the present invention is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (7)

1. A system function call method, the method comprising:
setting an overlay system function in an executable file of an application program; the coverage system function and the system function in the system library have the same function identification and function attribute parameters;
adding a springboard function corresponding to the coverage system function into a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, the function attribute parameters are the same, and the springboard function is provided with a function address of the system function; wherein the dynamic link library and the application program have isolation;
when the current function is called in the application program and the current function is an overlay system function, a dynamic link library of the application program is called; the dynamic link library comprises a springboard function, wherein the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
if the dynamic link library contains the function identification of the target springboard function corresponding to the function identification of the current function, the target springboard function calls the system function in the dynamic link library through the function address;
and calling the target springboard function after the system function in the application program.
2. The method according to claim 1, wherein the method further comprises:
and if the dynamic link library contains the target function to be called corresponding to the current function, calling the target function to be called.
3. The method according to claim 2, wherein if the dynamically linked library includes a target to-be-called function corresponding to the current function, the calling the target to-be-called function includes:
and if the function identifier of the function to be called corresponding to the function identifier of the current function is included in the dynamic link library, calling the function to be called.
4. The method of claim 1, wherein the system function comprises a C-function library C-function.
5. A system function call device, the device comprising:
the springboard function setting module is used for setting an overlay system function in an executable file of the application program; the coverage system function and the system function in the system library have the same function identification and function attribute parameters; adding a springboard function corresponding to the coverage system function into a dynamic link library of the application program; the function identification of the springboard function is different from the function identification of the coverage system function, the function attribute parameters are the same, and the springboard function is provided with a function address of the system function; wherein the dynamic link library and the application program have isolation;
the current function calling module is used for calling a dynamic link library of the application program when the current function is an overlay system function in the application program; the dynamic link library comprises a springboard function, wherein the springboard function has a corresponding function address, and the function address is a function address of a system function in the system library;
a system function calling module, configured to, if a function identifier of a target springboard function corresponding to the function identifier of the current function is included in the dynamic link library, call the system function in the dynamic link library by using the function address by using the target springboard function;
and the springboard function calling module is used for calling the target springboard function after the system function in the application program.
6. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method according to any one of claims 1-4 when executing a program stored on a memory.
7. One or more computer-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method of any of claims 1-4.
CN202111678012.6A 2021-12-31 2021-12-31 System function calling method, device, electronic equipment and readable medium Active CN114416219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111678012.6A CN114416219B (en) 2021-12-31 2021-12-31 System function calling method, device, electronic equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111678012.6A CN114416219B (en) 2021-12-31 2021-12-31 System function calling method, device, electronic equipment and readable medium

Publications (2)

Publication Number Publication Date
CN114416219A CN114416219A (en) 2022-04-29
CN114416219B true CN114416219B (en) 2023-05-23

Family

ID=81272083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111678012.6A Active CN114416219B (en) 2021-12-31 2021-12-31 System function calling method, device, electronic equipment and readable medium

Country Status (1)

Country Link
CN (1) CN114416219B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502745A (en) * 2016-10-26 2017-03-15 腾讯科技(深圳)有限公司 A kind of function calling method and device
CN106959859A (en) * 2017-03-30 2017-07-18 北京奇虎科技有限公司 The call method and device of system call function
CN110007984A (en) * 2019-04-02 2019-07-12 苏州思必驰信息科技有限公司 Function calling relationship retrogressive method and system based on Xtensa DSP
CN113448655A (en) * 2021-07-09 2021-09-28 赞同科技股份有限公司 C standard dynamic library calling method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6463583B1 (en) * 1999-04-08 2002-10-08 Novadigm, Inc. Dynamic injection of execution logic into main dynamic link library function of the original kernel of a windowed operating system
CN103150155B (en) * 2011-12-07 2016-08-03 金蝶软件(中国)有限公司 Data interception method and device
CN111610966A (en) * 2019-02-22 2020-09-01 龙芯中科技术有限公司 Program running method and device and computing equipment
CN112306683A (en) * 2020-10-29 2021-02-02 北京字节跳动网络技术有限公司 Function hijacking method, device, medium and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106502745A (en) * 2016-10-26 2017-03-15 腾讯科技(深圳)有限公司 A kind of function calling method and device
CN106959859A (en) * 2017-03-30 2017-07-18 北京奇虎科技有限公司 The call method and device of system call function
CN110007984A (en) * 2019-04-02 2019-07-12 苏州思必驰信息科技有限公司 Function calling relationship retrogressive method and system based on Xtensa DSP
CN113448655A (en) * 2021-07-09 2021-09-28 赞同科技股份有限公司 C standard dynamic library calling method and device

Also Published As

Publication number Publication date
CN114416219A (en) 2022-04-29

Similar Documents

Publication Publication Date Title
CN110134378B (en) Application program creating method and device, computer equipment and storage medium
CN108121594B (en) Process management method and device
CN111666096B (en) Hot updating method and device for target application, storage medium and electronic equipment
WO2022016848A1 (en) Method and apparatus for performing application deployment according to service role
CN110727440B (en) Software packaging method
CN106294113B (en) creation method and device based on programmable test service
CN111399840B (en) Module development method and device
CN104750528A (en) Management method and device for components in Android program
CN105740033A (en) Terminal equipment, plug-in loading and running device and plug-in loading and running method
CN104699503A (en) Method and device for replacing function execution logic in Android system
CN104731622A (en) Application program loading method and device and mobile terminal
CN114942796A (en) Plug-in compiling and calling method, device, equipment and storage medium
CN108845800B (en) Method, device, equipment and storage medium for realizing component extension function
CN112035122A (en) Interface deployment method, system and storage medium
CN111651169B (en) Block chain intelligent contract operation method and system based on web container
CN114416219B (en) System function calling method, device, electronic equipment and readable medium
CN112764756A (en) Software resource compiling method and corresponding device, equipment and medium
CN114490103A (en) Operating system interface calling method and device and electronic equipment
CN110018831B (en) Program processing method, program processing apparatus, and computer-readable storage medium
US10606612B2 (en) Context check bypass to enable opening shared-object libraries
CN116401003A (en) Android application running method, system and storage medium based on desktop operating system
CN116342283A (en) Trusted intelligent contract implementation method, device, equipment and readable storage medium
CN106778270B (en) Malicious application detection method and system
CN113177292B (en) Universal BIM secondary development implementation method and device
CN114201174A (en) Construction method and device of hybrid mobile application, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant