CN115080006A - Data calling method and related equipment - Google Patents
Data calling method and related equipment Download PDFInfo
- Publication number
- CN115080006A CN115080006A CN202110277530.0A CN202110277530A CN115080006A CN 115080006 A CN115080006 A CN 115080006A CN 202110277530 A CN202110277530 A CN 202110277530A CN 115080006 A CN115080006 A CN 115080006A
- Authority
- CN
- China
- Prior art keywords
- data
- application layer
- interface
- calling
- name
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 76
- 230000006870 function Effects 0.000 claims description 113
- 238000004590 computer program Methods 0.000 claims description 12
- 238000001514 detection method Methods 0.000 claims description 4
- 238000013075 data extraction Methods 0.000 claims description 3
- 230000008569 process Effects 0.000 description 6
- 238000011161 development Methods 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 3
- 230000000644 propagated effect Effects 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000004806 packaging method and process Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/33—Intelligent editors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
- G06F9/449—Object-oriented method invocation or resolution
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the invention discloses a data calling method and related equipment, wherein the method comprises the following steps: acquiring interface data of an SO module, wherein the interface data comprises a name of a class corresponding to an application layer, an interface function name corresponding to the application layer and signature information corresponding to the application layer; establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer; acquiring a function parameter to be called according to the request for calling the interface data; generating a target data calling function according to the function parameter to be called and the initial data calling template; and calling a function based on the target data to finish calling the data in the SO module.
Description
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a data calling method and related equipment.
Background
In the prior art, because the SO module is a functional module written in C + + language, when providing data to an application layer, it is necessary to define an interface signature of an application layer corresponding to each interface at each interface of the SO module, and the interface signatures have different parameter types, which results in different writing equations and writing manners, the writing manner of each interface of the existing SO module is to write the signature information and the interface information of the application layer separately, which may further lead to a complicated signature writing process of the interface of the SO module, and when a new parameter is added, it is easy to forget to modify the signature of the interface of the SO module, which leads to program crash, and at the same time separately writing the signature information and the interface information of the application layer may easily lead to corresponding errors between the signature information and the interface information, or writing errors, which may further lead to developers being difficult to maintain the program, especially when the interfaces are more and more, maintenance of the program is more difficult.
Disclosure of Invention
The embodiment of the invention provides a data calling method and related equipment, which realize data calling when functional modules written by C + + languages such as SO modules and the like are provided for application layer data.
In a first aspect, an embodiment of the present invention provides a data calling method, including:
acquiring interface data of an SO module, wherein the interface data comprises a name of a class corresponding to an application layer, an interface function name corresponding to the application layer and signature information corresponding to the application layer;
establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer;
acquiring a function parameter to be called according to the request for calling the interface data;
generating a target data calling function according to the function parameter to be called and the initial data calling template;
and calling a function based on the target data to finish calling the data in the SO module.
Optionally, the step of establishing an initial data call template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer includes:
storing the name of the class corresponding to the application layer, the name of the interface function corresponding to the application layer and the signature information corresponding to the application layer to obtain a data structure;
and taking the data structure body as the initial data calling template.
Optionally, the step of storing the name of the class corresponding to the application layer, the name of the interface function corresponding to the application layer, and the signature information corresponding to the application layer to obtain the data structure includes:
and storing the name of the class of the application layer, the name of the interface function corresponding to the application layer and the signature information corresponding to the application layer according to a set storage mode to obtain the data structure body.
Optionally, before the step of generating the target data call template according to the data to be called and the initial data call template, the method further includes:
storing the initial data calling template into a preset interface of the SO module;
and carrying out unicity detection on the initial data calling template.
Optionally, the step of storing the initial data call template in a preset interface of the SO module includes:
writing a preset interface of the SO module:
bool AddMethod(char*classname,char*methodname,char*methodsig){
wherein, AddMethod is the name of the interface, classname is the name of the class corresponding to the application layer, methodname is the name of the method corresponding to the application layer, and methodsig is the signature information of the interface corresponding to the application layer;
and storing the initial data call template into a preset interface of the written SO module.
Optionally, the step of obtaining the parameter of the function to be called according to the request for calling the interface data includes:
registering data to be called corresponding to the request to the initial data calling template according to the request for calling the interface data to acquire the function parameter to be called, wherein the function parameter comprises a function name of the data to be called, a parameter of the data to be called and signature information of the application layer.
Optionally, the method further includes:
counting the number of the initial data calling templates in the preset interface in real time;
and carrying out log output on any initial data calling template according to the number of the initial data calling templates.
In a second aspect, an embodiment of the present application provides a data invoking device, including:
the data acquisition module is used for acquiring interface data of the SO module, wherein the interface data comprises a name of a class corresponding to an application layer, an interface function name corresponding to the application layer and signature information corresponding to the application layer;
the template establishing module is used for establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer;
the data extraction module is used for acquiring a function parameter to be called according to the request for calling the interface data;
the generating module is used for generating a target data calling function according to the function parameter to be called and the initial data calling template;
and the calling module is used for calling a function based on the target data to finish calling the data in the SO module.
In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor and a computer program stored in the memory and executable on the processor, the processor being configured to implement the steps of the data call method as described above when executing the computer program stored in the memory.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored: which when executed by a processor implements the steps of the data call method as described above.
The embodiment of the invention has the following advantages or beneficial effects:
the method comprises the steps that interface data of an SO module are obtained, wherein the interface data comprise names of classes corresponding to an application layer, names of interface functions corresponding to the application layer and signature information corresponding to the application layer; establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer; acquiring a function parameter to be called according to the request for calling the interface data; generating a target data calling function according to the function parameter to be called and the initial data calling template; and calling a function based on the target data to finish calling the data in the SO module. The interface data comprises the name of the class corresponding to the application layer, the name of the interface function corresponding to the application layer, the signature information corresponding to the application layer and the function parameter of the data to be called are combined to generate the target data calling function, so that the signature information and the interface information are convenient to correspond, the risk that the signature information and the interface information are wrongly corresponded or wrongly written due to the fact that the signature information and the interface information of the application layer are separately written when the data are called is reduced, and further developers can conveniently maintain programs.
Drawings
Fig. 1 is a flowchart of a data calling method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a data call device according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a storage medium according to an embodiment of the present application.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Fig. 1 is a flowchart of a data calling method provided in an embodiment of the present application, where the data calling method provided in this embodiment writes derived data and an interface signature definition together, so that a developer is easy to maintain a program, and a risk of program crash caused by forgetting to add a signature by the developer is also avoided. The method may be performed by a data invocation device, which may be implemented in software and/or hardware, typically integrated in a terminal.
As shown in fig. 1, a data calling method includes:
s101, obtaining interface data of an SO module, wherein the interface data comprises a name of a class corresponding to an application layer, an interface function name corresponding to the application layer and signature information corresponding to the application layer;
in a possible implementation manner, the step of establishing an initial data call template according to the name of the class of the application layer, the name of the interface function corresponding to the application layer, and the signature information corresponding to the application layer includes:
storing the name of the class corresponding to the application layer, the name of the interface function corresponding to the application layer and the signature information corresponding to the application layer to obtain a data structure;
and taking the data structure body as the initial data calling template.
Illustratively, one data structure is defined to contain all data:
Struct methodinfo{
string classname;
string methodname;
string methodsig;}
wherein, string classname; the name of the corresponding class of the application layer is stored in a character string mode; string methodname; storing the interface name of the application layer corresponding to the SO module interface; string methodsig; storing function signature information of an interface of an application layer corresponding to the SO module interface, namely the return value type of the function and all parameter types; struct method is a functional statement that defines the structure.
Illustratively, the data structure is used to store the name of the class of the corresponding application layer, the name of the interface of the corresponding application layer and the function signature information of the interface of the corresponding application layer, SO that the subsequent quick search of the SO module interface can be facilitated.
In a possible embodiment, the step of storing the name of the class corresponding to the application layer, the name of the interface function corresponding to the application layer, and the signature information corresponding to the application layer to obtain the data structure includes:
and storing the name of the class of the application layer, the name of the interface function corresponding to the application layer and the signature information corresponding to the application layer according to a set storage mode to obtain the data structure body.
Illustratively, a set function statement is employed:
set<methodinfo>methodset;
the set storage is realized, one method of one class can be guaranteed to be unique, so that a developer can check conveniently, when a repeated method is defined, the set function statement can check that the repeated method exists, and further informs the developer of an error.
S102, establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the class name of the application layer;
in a possible implementation manner, the step of generating a target data call template according to the data to be called and the initial data call template includes:
storing the initial data calling template into a preset interface of the SO module;
and carrying out unicity detection on the initial data calling template.
Illustratively, the preset interface of the SO module is written:
bool AddMethod(char*classname,char*methodname,char*methodsig){
wherein, AddMethod is the name of the interface, classname is the name of the class corresponding to the application layer, methodname is the name of the method corresponding to the application layer, and methodsig is the signature information of the interface corresponding to the application layer.
Illustratively, a preset interface of the SO module is written to store a method for data call between an interface other than the preset interface of the SO module and the application layer, and a method for detecting whether the same method exists in the method for data call between the interface other than the preset interface and the application layer is performed in a single way, SO that whether a human development error exists can be known in a development stage.
In a possible implementation, the step of performing a uniqueness test on the initial data call template includes:
constructing a methodinfo structure
Methodinfo m(classname,methodname,methodsig);
The parameters of the above structure are: classname corresponds to the name of the class of the application layer, methodname corresponds to the name of the method of the application layer, and methodsig corresponds to the signature information of the interface of the application layer.
Bool bFond=methodset.find(m);
See if there is a duplicate interface by the set lookup find interface.
If the returned value bfound is true, it indicates that the same interface is found, and indicates that the above-mentioned interface has been stored before, and reports an error, and prompts the developer that the current interface has been created before, so that it is possible to find that the program has an error during the program development without reporting an error when the program is executed.
If the returned value bfound is false, indicating that no finding was found, then it is possible to insert a statement:
Methodset.insert(m);
the insertion of the interface is performed.
Illustratively, errors are found in time in the development process of the program, so that the problem that the errors can be found only when the program is executed is avoided, further, the complete program inspection by developers is avoided, the workload of the developers is reduced, and the research and development efficiency is improved.
In a possible implementation, the step of performing a uniqueness test on the initial data call template includes:
defining a first macrocommand:
#define CHECK_METHOD(classname,methodname,methodsig)\
static bool bstatic_##methodid=AddMethod(classname,methodname,methodsig);\
and detecting the initial data call template, wherein the macro command adopts a static variable bstatic _ # method, the AddMethod is a preset interface name of a module providing data for an application layer, the Classname is a name of a class corresponding to the application layer, the methodname is a name of an interface function corresponding to the application layer, and the methodsig is signature information corresponding to the application layer.
Illustratively, the written interface is checked immediately when the interface is written, so that a developer can timely know whether the currently written interface is registered or not when developing, the definition and the check of the written interface parameters are bound together to form a whole, and the parameter modification cannot be missed if the interface is modified subsequently.
S103, acquiring a function parameter to be called according to the request for calling the interface data;
in one possible implementation, the interface hasId in the SO module is written to be provided to the application layer for use:
CHECK_METHOD(javaClassName,"hasId","(I)Z")
JNIEXPORT jboolean JNICALL Java_com_hashId(JNIEnv*_env,jclass,jint_taskid){
JNIEPORT represents that the interface is exported to an application layer for use, jboilean represents a return value, JNICALL represents a function to be called in the SO module, Java _ com _ hashId represents a function name to be called in the SO module, and JNIENV _ env, jclass and jnt _ taskid are parameters of the function to be called in the SO module.
Illustratively, invoking the second macro command:
CHECK_METHOD(javaClassName,"hasId","(I)Z")
wherein CHECK _ METHOD is the first macro command; javaClassName is the class name of the application layer in the corresponding so module interface; "hasId" is the application layer function name corresponding to the so module interface in the application layer; and "(I) Z" represents the signature information of the so module interface, wherein the signature information is the parameter and the return value of the function to be called in the so module.
In a possible implementation manner, the step of obtaining the parameter of the function to be called according to the request for calling the interface data includes:
registering data to be called corresponding to the request to the initial data calling template according to the request for calling the interface data to acquire the function parameter to be called, wherein the function parameter comprises a function name of the data to be called, a parameter of the data to be called and signature information of the application layer.
Exemplarily, the interface detection of the SO module and the definition process of the function of the application layer are set before the process of accessing the interface, SO that forgetting to define the interface definition of the SO module corresponding to the application layer is avoided, and meanwhile, when the number of parameters or the types of the parameters need to be modified, the definition of the function of the application layer and the definition process of the interface of the SO module corresponding to the application layer are combined, SO that the modification is facilitated, and the modification is not easy to forget; and simultaneously, AddMethod is called in the concrete realization of the macro to check the function, so that the same function is prevented from being written, and the writing error can be timely found.
S104, generating a target data calling function according to the function parameter to be called and the initial data calling template;
in a possible implementation manner, before the calling the function based on the target data completes the call to the data in the SO module, the method further includes:
the functional signature of the interface is verified.
Illustratively, all interfaces with JNIEXPORT are scanned;
scanning out all interface calls of CHECK _ METHOD;
the verification is performed based on all interfaces with JNIEXPORT and all interfaces of CHECK _ METHOD.
Illustratively, if the SO module interface defines JNIEXPORT, it indicates that the interface is an interface provided for application layer invocation, and when the interface does not define interface invocation of CHECK _ METHOD, an alarm is given to prompt a developer that the current interface does not define interface invocation of CHECK _ METHOD, SO that an error prompt can be directly given in a development stage.
If the developer defines the interface call of the CHECK _ METHOD, detecting whether the interface name provided by the interface to the application layer has a one-to-one corresponding METHOD in the class and the interface of the application layer, wherein the interface comprises the class name, the METHOD name and the parameter signature corresponding to the application layer, and if the one-to-one corresponding METHOD is not found in the class and the interface of the application layer by the interface name provided by the interface to the application layer, alarming is also carried out to prompt the developer to have a current definition error.
Furthermore, the matching of the signature of the interface and the parameters is detected, and even if the interface is defined and the method of the application layer is also defined, the parameter type can only know whether the interface is matched or not when the program is executed, and the program execution needs to go through complicated processes of packaging, compiling, executing and the like. And scanning the interface declared as JNIEXXPORT on the so module to obtain the return value of the interface of the JNIEXXPORT, the number of the parameters and the parameter type of each parameter.
And (3) finding the signature information methodsig during interface registration from the CHECK _ METHOD, and analyzing a function return value, the number of parameters and the parameter type of each parameter based on the signature information.
Comparing the analyzed parameters with the signature information methodsig transmitted in the CHECK _ METHOD, so as to compare whether the parameters are consistent with all the parameters of the signature information, if not, directly prompting a developer that the current definition is wrong, and directly prompting parameter errors or return value errors in a development stage, thereby avoiding the problem of program crash caused by mismatching of the parameters when the developer executes a program.
In a possible implementation manner, before the step of completing the call to the data in the SO module based on the target data calling function, the method further includes:
when the so module is initialized, detecting whether parameters of all interfaces are consistent with signature information of an application layer;
if not, alarming and notifying the technician.
Illustratively, the corresponding java class instance is obtained: when the data to be called is registered, 3 parameters, namely class name, methodname and methodsig, are bound, wherein the parameters are respectively the name of the class, the name of the method and the signature information of the method.
By functional statement:
class cls=env->FindClass(classname);
whether the java class exists is searched through the FindClass of the jni interface, a search result is obtained through a returned value cls, if the java class does not exist, the application layer does not have the interface, an alarm is given, and error information is given;
the method for acquiring the corresponding java class comprises the following steps:
and after the corresponding java class is acquired, acquiring the corresponding java class, if the method and the parameter are matched, acquiring the method, and if the method and the parameter are not matched and the acquired method is empty, directly judging that the current parameter or the method is not matched, indicating that an error exists and giving an alarm.
By means of the function:
jmethodID mid=env->GetMethodID(cls,methodname,methodsig);
the cls is the searched java class, the methodname is a method of the SO module interface corresponding to the application layer, and the methodsig represents the signature information of the method of the corresponding java class.
If the return value mid is not null, the method of finding the corresponding java class is indicated;
if the return value mid is empty, it indicates that the corresponding java class method is not found, and error information can be prompted to give an alarm.
And S105, calling the data in the SO module based on the target data calling function.
In one possible embodiment, the method further comprises:
counting the number of the initial data calling templates in the preset interface in real time;
and carrying out log output on any initial data calling template according to the number of the initial data calling templates.
Illustratively, an interface AddMethod is defined to register all interfaces, and a variable methodset is used to store all interfaces for java layers in the SO module, SO that the number of the interfaces provided by the current SO module can be easily counted, and then log output can be conveniently performed on all the interfaces, that is, all elements in the methodset only need to be traversed, and all the interfaces can be conveniently output, SO that the number and the parameter types of the interfaces in the SO module can be conveniently compared, the function defined by the SO module can be conveniently known, and functions such as interface registration monitoring function, historical change information of the interfaces and the like can be conveniently added based on a uniform interface.
The method comprises the steps that interface data of an SO module are obtained, wherein the interface data comprise names of classes corresponding to an application layer, names of interface functions corresponding to the application layer and signature information corresponding to the application layer; establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer; acquiring a function parameter to be called according to the request for calling the interface data; generating a target data calling function according to the function parameter to be called and the initial data calling template; and calling a function based on the target data to finish calling the data in the SO module. The interface data comprises the name of the class corresponding to the application layer, the name of the interface function corresponding to the application layer, the signature information corresponding to the application layer and the function parameter of the data to be called are combined to generate the target data calling function, so that the signature information and the interface information are convenient to correspond, the risk that the signature information and the interface information are wrongly corresponded or wrongly written due to the fact that the signature information and the interface information of the application layer are separately written when the data are called is reduced, and further developers can conveniently maintain programs. The interface checking function is carried out immediately when the interface of each SO module is written, SO that a developer can conveniently know whether the interface is registered or not when developing, the definition and the checking of the interface parameters are integrated, and the modification of the parameters cannot be missed if any modification is carried out subsequently.
In a second aspect, as shown in fig. 2, an embodiment of the present application provides a data invoking device, including:
the data acquisition module 201 is configured to acquire interface data of the SO module, where the interface data includes a name of a class corresponding to an application layer, an interface function name corresponding to the application layer, and signature information corresponding to the application layer;
the template establishing module 202 is configured to establish an initial data call template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer;
the data extraction module 203 is configured to obtain a function parameter to be called according to a request for calling the interface data;
a generating module 204, configured to generate a target data call function according to the parameter of the function to be called and the initial data call template;
and the calling module 205 is configured to call a function based on the target data to complete the call of the data in the SO module.
Referring to fig. 3, fig. 3 is a schematic diagram of an embodiment of an electronic device according to an embodiment of the present disclosure.
As shown in fig. 3, an electronic device according to an embodiment of the present application includes a memory 310, a processor 320, and a computer program 311 stored in the memory 320 and executable on the processor 320, where the processor 320 executes the computer program 311 to implement the following steps: acquiring interface data of an SO module, wherein the interface data comprises a name of a class corresponding to an application layer, an interface function name corresponding to the application layer and signature information corresponding to the application layer; establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer; acquiring a function parameter to be called according to the request for calling the interface data; generating a target data calling function according to the function parameter to be called and the initial data calling template; and calling a function based on the target data to finish calling the data in the SO module.
As shown in fig. 4, the present embodiment provides a computer-readable storage medium 400, on which a computer program 411 is stored, the computer program 411 implementing the following steps when executed by a processor: acquiring interface data of an SO module, wherein the interface data comprises a name of a class corresponding to an application layer, an interface function name corresponding to the application layer and signature information corresponding to the application layer; establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the class name of the application layer; acquiring a function parameter to be called according to the request for calling the interface data; generating a target data calling function according to the function parameter to be called and the initial data calling template; and calling a function based on the target data to finish calling the data in the SO module.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer-readable storage medium may be, for example but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It will be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general purpose computing device, they can be centralized in a single computing device or distributed over a network of multiple computing devices, and they can alternatively be implemented by program code executable by a computing device, so that they can be stored in a storage device and executed by a computing device, or they can be separately fabricated into various integrated circuit modules, or multiple modules or steps thereof can be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (10)
1. A data calling method, comprising:
acquiring interface data of an SO module, wherein the interface data comprises a name of a class corresponding to an application layer, an interface function name corresponding to the application layer and signature information corresponding to the application layer;
establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer;
acquiring a function parameter to be called according to the request for calling the interface data;
generating a target data calling function according to the function parameter to be called and the initial data calling template;
and calling a function based on the target data to finish calling the data in the SO module.
2. The data call method according to claim 1, wherein the step of creating an initial data call template corresponding to the interface function name of the application layer and the signature information of the application layer according to the name of the class of the application layer comprises:
storing the name of the class corresponding to the application layer, the name of the interface function corresponding to the application layer and the signature information corresponding to the application layer to generate a data structure;
and taking the data structure body as the initial data calling template.
3. The data call method according to claim 2, wherein the step of storing the name of the class corresponding to the application layer, the name of the interface function corresponding to the application layer, and the signature information corresponding to the application layer to generate the data structure includes:
and storing the name of the class of the application layer, the name of the interface function corresponding to the application layer and the signature information corresponding to the application layer according to a set storage mode to obtain the data structure body.
4. The data call method according to claim 1, further comprising, before the step of generating a target data call template from the data to be called and the initial data call template:
storing the initial data calling template into a preset interface of the SO module;
and performing unicity detection on the initial data calling template.
5. The data call method of claim 4, wherein the step of storing the initial data call template into a predetermined interface of the SO module comprises:
writing a preset interface of the SO module:
boolAddMethod(char*classname,char*methodname,char*methodsig){
wherein, AddMethod is the name of the interface, classname is the name of the class corresponding to the application layer, methodname is the name of the method corresponding to the application layer, and methodsig is the signature information of the interface corresponding to the application layer;
and storing the initial data call template into a preset interface of the SO module after writing.
6. The data call method according to claim 1, wherein the step of obtaining the parameter of the function to be called according to the request for calling the interface data comprises:
registering data to be called corresponding to the request to the initial data calling template according to the request for calling the interface data to acquire the function parameter to be called, wherein the function parameter comprises a function name of the data to be called, a parameter of the data to be called and signature information of the application layer.
7. The data call method according to claim 4, further comprising:
counting the number of the initial data calling templates in the preset interface in real time;
and carrying out log output on any initial data calling template according to the number of the initial data calling templates.
8. A data call apparatus, comprising:
the data acquisition module is used for acquiring interface data of the SO module, wherein the interface data comprises a name of a class corresponding to an application layer, an interface function name corresponding to the application layer and signature information corresponding to the application layer;
the template establishing module is used for establishing an initial data calling template corresponding to the interface function name of the application layer and the signature information corresponding to the application layer according to the name of the class of the application layer;
the data extraction module is used for acquiring a function parameter to be called according to the request for calling the interface data;
the generating module is used for generating a target data calling function according to the function parameter to be called and the initial data calling template;
and the calling module is used for calling a function based on the target data to finish calling the data in the SO module.
9. An electronic device, comprising: memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor is configured to implement the steps of the data call method according to any one of claims 1 to 7 when executing the computer program stored in the memory.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that: the computer program implementing the steps of the data call method according to any one of claims 1 to 7 when executed by a processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110277530.0A CN115080006A (en) | 2021-03-15 | 2021-03-15 | Data calling method and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110277530.0A CN115080006A (en) | 2021-03-15 | 2021-03-15 | Data calling method and related equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115080006A true CN115080006A (en) | 2022-09-20 |
Family
ID=83240788
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110277530.0A Pending CN115080006A (en) | 2021-03-15 | 2021-03-15 | Data calling method and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115080006A (en) |
Citations (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030014556A1 (en) * | 2001-04-26 | 2003-01-16 | Alan Conway | Method and system for a client invoking on an interface defined in a first notation to invoke an object having an interface defined in a second notation |
US20060190935A1 (en) * | 2005-02-18 | 2006-08-24 | International Business Machines Corporation | Method and apparatus for transforming Java native interface function calls into simpler operations during just-in-time compilation |
CN101216760A (en) * | 2007-12-28 | 2008-07-09 | 北京方正国际软件系统有限公司 | Dynamic mapping interface calling system and method |
KR20080069146A (en) * | 2007-01-22 | 2008-07-25 | 이쓰리넷(주) | Program generating apparatus in cross platform |
US20100095282A1 (en) * | 2008-10-10 | 2010-04-15 | The Boeing Company | Method, Apparatus And Computer Program Product For Creating Inter-Language Interface |
US20120167067A1 (en) * | 2010-12-23 | 2012-06-28 | International Business Machines Corporation | Batch dispatch of java native interface calls |
JP2012173771A (en) * | 2011-02-17 | 2012-09-10 | Hitachi Solutions Ltd | Library conversion method and program between programming languages |
KR20120126920A (en) * | 2011-05-13 | 2012-11-21 | (주)쉬프트웍스 | Method for Anti-Encoding Android by Using Java Native Interface |
US20150294102A1 (en) * | 2012-12-27 | 2015-10-15 | Feitian Technolgies Co., Ltd. | Method for java application to access intelligent key apparatus |
WO2016192556A1 (en) * | 2015-05-29 | 2016-12-08 | 北京金山安全软件有限公司 | Interface invoking method, device and terminal |
CN107832056A (en) * | 2017-12-14 | 2018-03-23 | 苏州蜗牛数字科技股份有限公司 | JAVA function calling methods in C++ based on JNI |
CN107977199A (en) * | 2016-10-19 | 2018-05-01 | 中国石油化工股份有限公司 | A kind of method that C++ function modules are called in java applet |
WO2018192025A1 (en) * | 2017-04-19 | 2018-10-25 | 北京洋浦伟业科技发展有限公司 | Method for protecting executable program on android platform |
CN109960597A (en) * | 2019-03-28 | 2019-07-02 | 武汉斗鱼鱼乐网络科技有限公司 | A kind of dynamic registration method and relevant apparatus of Applied layer interface |
CN110928548A (en) * | 2019-11-14 | 2020-03-27 | 腾讯音乐娱乐科技(深圳)有限公司 | Data processing method and equipment |
CN111176626A (en) * | 2019-08-05 | 2020-05-19 | 腾讯科技(深圳)有限公司 | Cross-programming-language code calling method and device, medium and equipment |
CN111381816A (en) * | 2020-03-17 | 2020-07-07 | 京东数字科技控股有限公司 | Application program acquisition method, device, equipment and storage medium |
CN112000398A (en) * | 2020-08-17 | 2020-11-27 | 苏州达家迎信息技术有限公司 | Method and device for determining bottom layer interface call link, computer equipment and medium |
-
2021
- 2021-03-15 CN CN202110277530.0A patent/CN115080006A/en active Pending
Patent Citations (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030014556A1 (en) * | 2001-04-26 | 2003-01-16 | Alan Conway | Method and system for a client invoking on an interface defined in a first notation to invoke an object having an interface defined in a second notation |
US20060190935A1 (en) * | 2005-02-18 | 2006-08-24 | International Business Machines Corporation | Method and apparatus for transforming Java native interface function calls into simpler operations during just-in-time compilation |
KR20080069146A (en) * | 2007-01-22 | 2008-07-25 | 이쓰리넷(주) | Program generating apparatus in cross platform |
CN101216760A (en) * | 2007-12-28 | 2008-07-09 | 北京方正国际软件系统有限公司 | Dynamic mapping interface calling system and method |
US20100095282A1 (en) * | 2008-10-10 | 2010-04-15 | The Boeing Company | Method, Apparatus And Computer Program Product For Creating Inter-Language Interface |
US20120167067A1 (en) * | 2010-12-23 | 2012-06-28 | International Business Machines Corporation | Batch dispatch of java native interface calls |
JP2012173771A (en) * | 2011-02-17 | 2012-09-10 | Hitachi Solutions Ltd | Library conversion method and program between programming languages |
KR20120126920A (en) * | 2011-05-13 | 2012-11-21 | (주)쉬프트웍스 | Method for Anti-Encoding Android by Using Java Native Interface |
US20150294102A1 (en) * | 2012-12-27 | 2015-10-15 | Feitian Technolgies Co., Ltd. | Method for java application to access intelligent key apparatus |
WO2016192556A1 (en) * | 2015-05-29 | 2016-12-08 | 北京金山安全软件有限公司 | Interface invoking method, device and terminal |
CN107977199A (en) * | 2016-10-19 | 2018-05-01 | 中国石油化工股份有限公司 | A kind of method that C++ function modules are called in java applet |
WO2018192025A1 (en) * | 2017-04-19 | 2018-10-25 | 北京洋浦伟业科技发展有限公司 | Method for protecting executable program on android platform |
CN107832056A (en) * | 2017-12-14 | 2018-03-23 | 苏州蜗牛数字科技股份有限公司 | JAVA function calling methods in C++ based on JNI |
CN109960597A (en) * | 2019-03-28 | 2019-07-02 | 武汉斗鱼鱼乐网络科技有限公司 | A kind of dynamic registration method and relevant apparatus of Applied layer interface |
CN111176626A (en) * | 2019-08-05 | 2020-05-19 | 腾讯科技(深圳)有限公司 | Cross-programming-language code calling method and device, medium and equipment |
CN110928548A (en) * | 2019-11-14 | 2020-03-27 | 腾讯音乐娱乐科技(深圳)有限公司 | Data processing method and equipment |
CN111381816A (en) * | 2020-03-17 | 2020-07-07 | 京东数字科技控股有限公司 | Application program acquisition method, device, equipment and storage medium |
CN112000398A (en) * | 2020-08-17 | 2020-11-27 | 苏州达家迎信息技术有限公司 | Method and device for determining bottom layer interface call link, computer equipment and medium |
Non-Patent Citations (1)
Title |
---|
ALEXW: "Android进阶知识树——JNI和So库 开发", Retrieved from the Internet <URL:《https://juejin.cn/post/6844903941101060104》> * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8516443B2 (en) | Context-sensitive analysis framework using value flows | |
US8490050B2 (en) | Automatic generation of user interfaces | |
US9418230B2 (en) | Automated tools for building secure software programs | |
US20070277163A1 (en) | Method and tool for automatic verification of software protocols | |
US8397104B2 (en) | Creation of test plans | |
US11307975B2 (en) | Machine code analysis for identifying software defects | |
US20210103514A1 (en) | Reusable test cases for identifiable patterns | |
CN110363004B (en) | Code vulnerability detection method, device, medium and equipment | |
CN111897724A (en) | Automatic testing method and device suitable for cloud platform | |
WO2021228036A1 (en) | Modification of codified infrastructure for orchestration in multi-cloud environment | |
CN110968437A (en) | Method, device, equipment and medium for parallel execution of single contract based on Java intelligent contract | |
US11422917B2 (en) | Deriving software application dependency trees for white-box testing | |
CN111045927A (en) | Performance test evaluation method and device, computer equipment and readable storage medium | |
KR102496539B1 (en) | Method for verifying software and apparatus therefor | |
US20150339219A1 (en) | Resilient mock object creation for unit testing | |
US9064042B2 (en) | Instrumenting computer program code by merging template and target code methods | |
CN111258562B (en) | Java code quality inspection method, device, equipment and storage medium | |
Harzevili et al. | Automatic Static Vulnerability Detection for Machine Learning Libraries: Are We There Yet? | |
CN116599881A (en) | Cloud platform tenant modeling test method, device, equipment and storage medium | |
CN115080006A (en) | Data calling method and related equipment | |
US11321218B1 (en) | Automated generation of source code models from machine code for code analysis | |
CN114942887A (en) | Program safety testing method, device, equipment and medium | |
WO2012079818A1 (en) | A method for validating run-time references | |
Entrup et al. | ARA: Automatic Instance-Level Analysis in Real-Time Systems | |
CN114780952B (en) | Detection method, system and storage medium for sensitive application call scene |
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 |