SDK calling method and device, computer device and storage medium
By querying and generating the function pointer addresses of third-party application functional classes in the Mini Program SDK, the problem of the Mini Program SDK depending on the host application is solved, enabling functional processing without dependencies.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PING AN TECH (SHENZHEN) CO LTD
- Filing Date
- 2020-05-27
- Publication Date
- 2026-04-24
AI Technical Summary
Traditional mini-program SDKs rely on the host application to provide classes and methods from third-party application SDKs, which means that functionality cannot be implemented properly when the host application cannot provide them.
By receiving and processing requests, querying the SDK information of preset third-party applications, obtaining the function classes and function pointer addresses, generating and assigning values to initialization function functions, and calling the target function function to process the request, the dependency on the host application is avoided.
The mini-program SDK enables normal request processing even when the host application cannot provide classes and methods, thus reducing the dependency on the host application.
Smart Images

Figure CN111666116B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an SDK invocation method, apparatus, computer device, and storage medium. Background Technology
[0002] With the development of computer technology, mini-program SDKs (Software Development Kits) have emerged. Currently, mini-program SDKs need to rely on the host application to implement the function of calling third-party application SDKs, such as sharing content to third-party applications and calling third-party applications to decompress files.
[0003] In the traditional approach, when a mini-program SDK relies on a host application to call the functions of a third-party application SDK, the host application needs to provide the classes and methods of the third-party application SDK. The mini-program SDK imports the provided classes and makes function calls to achieve the function. Alternatively, the host application can provide some proxies, and the mini-program SDK can set up proxies to allow the host application to help implement the function.
[0004] However, traditional methods require the host application to provide classes and methods or proxies from the third-party application SDK, which makes them highly dependent on the host application. If the host application is unable to provide classes and methods or proxies from the third-party application SDK, the mini-program SDK will not be able to perform the corresponding functions properly. Summary of the Invention
[0005] Therefore, it is necessary to provide an SDK calling method, device, computer equipment, and storage medium that enables the mini-program SDK to function properly, addressing the aforementioned technical issues.
[0006] An SDK invocation method, the method comprising:
[0007] Receive processing requests carrying functional parameters;
[0008] Based on the processing request, query the SDK information of the preset third-party application, obtain the third-party application function class corresponding to the processing request, perform a non-empty check on the third-party application function class, and obtain the check result;
[0009] When the judgment result is not empty, obtain the function pointer address of the third-party application corresponding to the processing request according to the processing request;
[0010] The initialization function is obtained based on the function class and function pointer address of the third-party application;
[0011] The target function is obtained by assigning values to the initialization function based on the function parameters.
[0012] Call the target function to process the request.
[0013] In one embodiment, querying the SDK information of a preset third-party application based on the processing request yields the third-party application function class corresponding to the processing request, including:
[0014] Based on the processing request, query the SDK information of the preset third-party application to obtain the function class name of the third-party application corresponding to the processing request;
[0015] Based on the third-party application function class name, obtain the third-party application function class corresponding to the request being processed.
[0016] In one embodiment, performing a non-empty check on a third-party application function class yields the following results:
[0017] The program information of the preset host application is queried based on the function class of the third-party application;
[0018] When the program information contains class information corresponding to the functional class of a third-party application, the judgment result is non-empty.
[0019] In one embodiment, when the determination result is not empty, obtaining the function pointer address of the third-party application corresponding to the processing request includes:
[0020] When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request to obtain the function name of the third-party application corresponding to the processing request;
[0021] The program information of the default host application is queried based on the function name of the third-party application, and the function pointer address of the third-party application corresponding to the processing request is obtained.
[0022] In one embodiment, the initialization function is obtained based on the third-party application's function class and the function pointer address, including:
[0023] Based on the function pointer address, generate the mapping address information corresponding to the function pointer address;
[0024] The initialization function is obtained based on the third-party application's function class and mapping address information.
[0025] In one embodiment, assigning values to the initialization function based on the function parameters to obtain the target function includes:
[0026] Get and process the name of the third-party application function class and the name of the third-party application function corresponding to the request;
[0027] The target function is obtained by filling in the initialization function with the third-party application's function class name, function name, and function parameters.
[0028] In one embodiment, invoking the target function to process the request includes:
[0029] Call the target function and obtain the function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function;
[0030] The system jumps to the function pointer address of the third-party application and executes the function. The function is used to process the request according to the function parameters in the target function.
[0031] An SDK invocation device, the device comprising:
[0032] The receiving module is used to receive processing requests carrying functional parameters;
[0033] The class acquisition module is used to query the SDK information of a preset third-party application based on the processing request, obtain the third-party application function class corresponding to the processing request, perform a non-empty check on the third-party application function class, and obtain the check result.
[0034] The address acquisition module is used to obtain the function pointer address of the third-party application corresponding to the processing request when the judgment result is not empty.
[0035] The function building module is used to obtain the initialization function based on the function class and function pointer address of the third-party application;
[0036] The assignment module is used to assign values to the initialization function based on the function parameters to obtain the target function.
[0037] The calling module is used to call the target function to process the request.
[0038] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program performing the following steps:
[0039] Receive processing requests carrying functional parameters;
[0040] Based on the processing request, query the SDK information of the preset third-party application, obtain the third-party application function class corresponding to the processing request, perform a non-empty check on the third-party application function class, and obtain the check result;
[0041] When the judgment result is not empty, obtain the function pointer address of the third-party application corresponding to the processing request according to the processing request;
[0042] The initialization function is obtained based on the function class and function pointer address of the third-party application;
[0043] The target function is obtained by assigning values to the initialization function based on the function parameters.
[0044] Call the target function to process the request.
[0045] A computer-readable storage medium having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0046] Receive processing requests carrying functional parameters;
[0047] Based on the processing request, query the SDK information of the preset third-party application, obtain the third-party application function class corresponding to the processing request, perform a non-empty check on the third-party application function class, and obtain the check result;
[0048] When the judgment result is not empty, obtain the function pointer address of the third-party application corresponding to the processing request according to the processing request;
[0049] The initialization function is obtained based on the function class and function pointer address of the third-party application;
[0050] The target function is obtained by assigning values to the initialization function based on the function parameters.
[0051] Call the target function to process the request.
[0052] The aforementioned SDK invokes methods, devices, computer equipment, and storage media to obtain the third-party application function class corresponding to the processing request using SDK information. It then checks if the third-party application function class is null. If the check is not null, it obtains the function pointer address of the corresponding third-party application based on the processing request. Based on the third-party application function class and the function pointer address, it obtains the initialization function. It assigns values to the initialization function according to the function parameters to obtain the target function, and then calls the target function to process the request. Throughout this process, the target function is obtained using the third-party application function class, function pointer address, and function parameters. This allows the processing of the request to be achieved by calling the target function. During processing, it is not necessary to import classes and methods from the host application or utilize proxies provided by the host application. This enables the mini-program SDK to normally process requests even when the host application cannot provide classes and methods or proxies from the third-party application. Attached Figure Description
[0053] Figure 1 This is a flowchart illustrating the SDK method invocation process in one embodiment.
[0054] Figure 2 This is a flowchart illustrating the SDK method invocation process in another embodiment;
[0055] Figure 3 This is a structural block diagram of an SDK invocation device in one embodiment;
[0056] Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0058] In one embodiment, such as Figure 1 As shown, an SDK invocation method is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0059] Step 102: Receive a processing request carrying functional parameters.
[0060] In this context, "processing request" refers to a request to invoke a third-party application's SDK to implement functionality. For example, a processing request might specifically be to share content to a third-party application. Another example is to invoke a third-party application to decompress a file. "Function parameters" refer to the parameters to be processed, corresponding to the processing request. For instance, when the processing request is to share content to a third-party application, the function parameter might be the URL (Uniform Resource Locator) address of the content to be shared. Similarly, when the processing request is to invoke a third-party application to decompress a file, the function parameter might be the file path of the file to be decompressed.
[0061] Specifically, when a user wants to call the function of a third-party application SDK through the mini-program SDK in the host application in the terminal, the user will send a processing request carrying function parameters to the mini-program SDK by operating the mini-program SDK.
[0062] Step 104: Query the SDK information of the preset third-party application according to the processing request, obtain the third-party application function class corresponding to the processing request, and perform a non-empty check on the third-party application function class to obtain the check result.
[0063] The pre-defined third-party application SDK information refers to the open-source SDK information of the third-party application corresponding to the mini-program SDK. This includes the correspondence between class names and functions, as well as the correspondence between function names and functions within the third-party application SDK. A class is the foundation for information encapsulation in object-oriented programming; it is a user-defined reference data type, also known as a class type. Each class contains data descriptions and a set of functions for manipulating data or passing messages. The third-party application function class corresponding to the request refers to the class used to implement the function corresponding to the request. For example, when the request is to share content to a third-party application, the specific third-party application function class corresponding to the request could be the class used by the third-party application to implement sharing. Similarly, when the request is to call a third-party application to decompress a file, the specific third-party application function class corresponding to the request could be the class used by the third-party application to implement decompression.
[0064] The non-empty check for third-party application function classes means determining whether the function class exists in the host application. If it exists, it means the host application has the capability to implement the corresponding function, and the mini-program SDK can implement the corresponding function. If it does not exist, it means the host application cannot implement the corresponding function, and the mini-program SDK cannot implement the corresponding function. For example, when processing a request to share content to a third-party application, if the corresponding third-party application function class exists in the host application, it means the host application has the sharing capability. If the corresponding third-party application function class does not exist in the host application, it means sharing is not possible, i.e., the corresponding function cannot be implemented, and the corresponding protection mechanism will be triggered, preventing subsequent operations from being performed.
[0065] Specifically, the mini-program SDK in the terminal queries the SDK information of a pre-defined third-party application based on the processing request. From this information, it finds the class name string that implements the function corresponding to the processing request and dynamically generates the corresponding third-party application function class. For example, this can be dynamically generated using Objective-C based on the class name string. After generating the corresponding third-party application function class, the mini-program SDK in the terminal uses the program information of the pre-defined host application to perform a non-empty check on the third-party application function class to determine if it exists in the host application, and then obtains the result.
[0066] Step 106: When the judgment result is not empty, obtain the function pointer address of the third-party application corresponding to the processing request according to the processing request.
[0067] The function pointer address refers to the address of a third-party application SDK function that implements the function corresponding to the request in the host application.
[0068] Specifically, when the judgment result is not empty, it means that the host application has the ability to implement the corresponding function, that is, the mini program SDK can implement the corresponding function. The mini program SDK in the terminal will query the SDK information of the preset third-party application according to the processing request, obtain the function name of the third-party application corresponding to the processing request, and then obtain the function pointer address of the third-party application corresponding to the processing request based on the function name of the third-party application.
[0069] Step 108: Obtain the initialization function based on the third-party application's function class and function pointer address.
[0070] Among them, the initialization function refers to the unassigned function that has a mapping relationship with the address of the function pointer.
[0071] Specifically, the mini-program SDK in the terminal generates mapping address information corresponding to the function pointer address based on the function pointer address, and then obtains the initialization function based on the third-party application function class and the mapping address information.
[0072] Step 110: Assign values to the initialization function according to the function parameters to obtain the target function.
[0073] The target function refers to the assigned function that has a mapping relationship with the address of the function pointer.
[0074] Specifically, the mini-program SDK in the terminal obtains the third-party application function class name and the third-party application function name corresponding to the request. Based on the third-party application function class name, the third-party application function name, and the function parameters, it fills in the initialization function to obtain the target function.
[0075] Step 112: Call the target function to process the request.
[0076] Specifically, the mini-program SDK in the terminal can obtain the function pointer address of the third-party application corresponding to the address mapping information by calling the target function. Then, it can jump to the function of the third-party application according to the function pointer address and execute the function to process the request according to the function parameters in the target function.
[0077] The aforementioned SDK invocation method utilizes SDK information to obtain the third-party application function class corresponding to the processing request. It then checks if the third-party application function class is null. If the check is not null, it retrieves the function pointer address of the corresponding third-party application based on the processing request. Based on the third-party application function class and the function pointer address, it obtains the initialization function. The initialization function is then assigned values according to the function parameters to obtain the target function. Finally, the target function is called to process the request. This entire process utilizes the third-party application function class, function pointer address, and function parameters to obtain the target function. Therefore, by calling the target function, the processing request can be handled. During processing, it is not necessary to import classes and methods from the host application or utilize proxies provided by the host application. This allows the mini-program SDK to normally process requests even when the host application cannot provide classes and methods or proxies from the third-party application.
[0078] In one embodiment, querying the SDK information of a preset third-party application based on the processing request yields the third-party application function class corresponding to the processing request, including:
[0079] Based on the processing request, query the SDK information of the preset third-party application to obtain the function class name of the third-party application corresponding to the processing request;
[0080] Based on the third-party application function class name, obtain the third-party application function class corresponding to the request being processed.
[0081] In this context, the third-party application function class name refers to the name of the class used to implement the function corresponding to handling the request. For example, the third-party application function class name can specifically be a string representing the class.
[0082] Specifically, the processing request corresponds to a function. After receiving the processing request, the mini-program SDK in the terminal determines the function that the processing request wants to call. Based on the function that the processing request wants to call, it queries the SDK information of the preset third-party application. The SDK information of the preset third-party application includes the correspondence between class names and functions. This information can be obtained from the open-source SDK data of the third-party application. By querying the correspondence between class names and functions, the function class name of the third-party application corresponding to the processing request can be obtained. Then, based on the function class name of the third-party application, the function class of the third-party application corresponding to the processing request can be obtained.
[0083] Furthermore, the processing request includes a function identifier, which identifies the function to be invoked. The mini-program SDK queries the SDK information of the pre-defined third-party application based on the function identifier to obtain the function class name of the third-party application corresponding to the processing request. The method for obtaining the third-party application function class corresponding to the processing request based on the function class name can be dynamically generated using the Objective-C language.
[0084] In this embodiment, by processing the request, the name of the third-party application function class corresponding to the processing request is obtained, and the third-party application function class corresponding to the processing request is obtained based on the name of the third-party application function class, thus enabling the acquisition of the third-party application function class.
[0085] In one embodiment, performing a non-empty check on a third-party application function class yields the following results:
[0086] The program information of the preset host application is queried based on the function class of the third-party application;
[0087] When the program information contains class information corresponding to the functional class of a third-party application, the judgment result is non-empty.
[0088] Among them, the program information of the default host application refers to the code information of the host application.
[0089] Specifically, the mini-program SDK in the terminal queries the program information of the preset host application based on the function class of the third-party application to check if there is corresponding class information in the program information. The program information of the preset host application includes the classes of the integrated third-party applications. When the program information contains class information corresponding to the function class of the third-party application, it means that the host application has the ability to implement the corresponding function, and the judgment result is not empty.
[0090] In this embodiment, by querying the program information of the preset host application to see if there is class information corresponding to the function class of the third-party application, it is possible to determine whether the function class of the third-party application is empty.
[0091] In one embodiment, when the determination result is not empty, obtaining the function pointer address of the third-party application corresponding to the processing request includes:
[0092] When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request to obtain the function name of the third-party application corresponding to the processing request;
[0093] The program information of the default host application is queried based on the function name of the third-party application, and the function pointer address of the third-party application corresponding to the processing request is obtained.
[0094] Here, "third-party application function name" refers to the name of a function in the third-party application. For example, the function name can be a string representing the function.
[0095] Specifically, when the judgment result is not empty, the mini-program SDK in the terminal will query the SDK information of the preset third-party application according to the processing request. The SDK information of the preset third-party application includes the correspondence between function names and functions. This information can be obtained from the open-source SDK data of the third-party application. By querying the correspondence between function names and functions, the function name of the third-party application corresponding to the processing request can be obtained. Then, based on the function name of the third-party application, the program information of the preset host application is queried to obtain the function pointer address of the third-party application corresponding to the processing request.
[0096] Furthermore, the processing request carries a function identifier, which identifies the function to be invoked. The mini-program SDK queries the SDK information of the pre-defined third-party application based on the function identifier to obtain the function name of the third-party application corresponding to the processing request. By querying the program information of the pre-defined host application based on the function name of the third-party application, the function code segment can be found in the program information, and then the function pointer address of the third-party application corresponding to the processing request can be obtained from the function code.
[0097] In this embodiment, by processing the request, the function name of the third-party application corresponding to the processing request is obtained. Based on the function name of the third-party application, the program information of the preset host application is queried to obtain the function pointer address of the third-party application corresponding to the processing request, thus enabling the acquisition of the function pointer address.
[0098] In one embodiment, the initialization function is obtained based on the third-party application's function class and the function pointer address, including:
[0099] Based on the function pointer address, generate the mapping address information corresponding to the function pointer address;
[0100] The initialization function is obtained based on the third-party application's function class and mapping address information.
[0101] The mapped address information is used to map the addresses of function pointers.
[0102] Specifically, the mini-program SDK in the terminal generates a mapping address information corresponding to the function pointer address. This mapping address information allows the user to jump to the function pointer address and execute the function. After obtaining the mapping address information, the mini-program SDK in the terminal obtains the initialization function based on the third-party application's function class and the mapping address information. This initialization function does not assign parameter values, function class names, or function names. Furthermore, the mini-program SDK in the terminal can obtain the initialization function using the Objective-C language.
[0103] In this embodiment, the mapping address information corresponding to the function pointer address is generated through the function pointer address, and the initialization function is obtained according to the function class of the third-party application and the mapping address information, thus enabling the acquisition of the initialization function.
[0104] In one embodiment, assigning values to the initialization function based on the function parameters to obtain the target function includes:
[0105] Get and process the name of the third-party application function class and the name of the third-party application function corresponding to the request;
[0106] The target function is obtained by filling in the initialization function with the third-party application's function class name, function name, and function parameters.
[0107] Specifically, the mini-program SDK in the terminal can obtain the third-party application function class name and function name corresponding to the processing request by querying the SDK information of the preset third-party application according to the processing request. Then, it can identify the fields to be filled in the initialization function that correspond to the third-party application function class name, the third-party application function name, and the function parameters, respectively. The target function is obtained by filling in the fields to be filled according to the third-party application function class name, the third-party application function name, and the function parameters.
[0108] In this embodiment, by obtaining the third-party application function class name and the third-party application function name corresponding to the processing request, and filling the initialization function with the third-party application function class name, the third-party application function name, and function parameters, the target function can be obtained, thus enabling the acquisition of the target function.
[0109] In one embodiment, invoking the target function to process the request includes:
[0110] Call the target function and obtain the function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function;
[0111] The system jumps to the function pointer address of the third-party application and executes the function. The function is used to process the request according to the function parameters in the target function.
[0112] Specifically, the mini-program SDK in the terminal calls the target function, obtains the function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function, jumps to the function of the third-party application according to the function pointer address, executes the function, and processes the request according to the function parameters in the target function.
[0113] In this embodiment, by calling the target function, the function pointer address of the third-party application corresponding to the address mapping information in the target function is obtained. Then, the function pointer address is used to jump to the function of the third-party application and execute the function. This enables the processing of requests based on the function parameters in the target function.
[0114] like Figure 2 As shown, an embodiment is used to illustrate the SDK invocation method of this application, including the following steps:
[0115] Step 202: Receive a processing request carrying functional parameters;
[0116] Step 204: Query the SDK information of the preset third-party application according to the processing request to obtain the function class name of the third-party application corresponding to the processing request;
[0117] Step 206: Obtain the third-party application function class corresponding to the processing request based on the third-party application function class name;
[0118] Step 208: Query the program information of the preset host application based on the function class of the third-party application;
[0119] Step 210: When the program information contains class information corresponding to the functional class of the third-party application, the judgment result is non-empty;
[0120] Step 212: When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request to obtain the function name of the third-party application corresponding to the processing request.
[0121] Step 214: Query the program information of the preset host application based on the function name of the third-party application to obtain the function pointer address of the third-party application corresponding to the processing request;
[0122] Step 216: Generate mapping address information corresponding to the function pointer address based on the function pointer address;
[0123] Step 218: Obtain the initialization function based on the third-party application's function class and mapping address information;
[0124] Step 220: Obtain the class name and function name of the third-party application corresponding to the request.
[0125] Step 222: Fill the initialization function with the third-party application function class name, the third-party application function name, and the function parameters to obtain the target function.
[0126] Step 224: Call the target function and obtain the function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function.
[0127] Step 226: Jump to the function of the third-party application according to the function pointer address, and execute the function. The function is used to process the request according to the function parameters in the target function.
[0128] It should be understood that, although Figure 1-2 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1-2 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.
[0129] In one embodiment, such as Figure 3 As shown, an SDK invocation device is provided, including: a receiving module 302, a class acquisition module 304, an address acquisition module 306, a function construction module 308, an assignment module 310, and an invocation module 312, wherein:
[0130] The receiving module 302 is used to receive a processing request carrying functional parameters;
[0131] The class acquisition module 304 is used to query the SDK information of a preset third-party application according to the processing request, obtain the third-party application function class corresponding to the processing request, perform a non-empty check on the third-party application function class, and obtain the check result.
[0132] The address acquisition module 306 is used to obtain the function pointer address of the third-party application corresponding to the processing request when the judgment result is not empty.
[0133] Function construction module 308 is used to obtain the initialization function based on the function class and function pointer address of the third-party application;
[0134] The assignment module 310 is used to assign values to the initialization function according to the function parameters to obtain the target function;
[0135] Module 312 is used to call the target function to process the request.
[0136] The aforementioned SDK invocation device uses SDK information to obtain the third-party application function class corresponding to the processing request, and performs a non-empty check on the third-party application function class. If the check result is not empty, it obtains the function pointer address of the third-party application corresponding to the processing request, obtains the initialization function based on the third-party application function class and the function pointer address, assigns values to the initialization function based on the function parameters, obtains the target function, and calls the target function to process the processing request. The entire process utilizes the third-party application function class, function pointer address, and function parameters to obtain the target function, thereby enabling the processing of the request by calling the target function. During the processing, it is not necessary to import the classes and methods of the host application or use the proxy provided by the host application. This allows the mini-program SDK to normally process the processing request even when the host application cannot provide the classes and methods or the proxy of the third-party application.
[0137] In one embodiment, the class acquisition module is further configured to query the SDK information of a preset third-party application based on the processing request, obtain the function class name of the third-party application corresponding to the processing request, and obtain the function class of the third-party application corresponding to the processing request based on the function class name of the third-party application.
[0138] In one embodiment, the class acquisition module is further configured to query the program information of the preset host application based on the function class of the third-party application, and when the program information contains class information corresponding to the function class of the third-party application, the judgment result is non-empty.
[0139] In one embodiment, the address acquisition module is further configured to, when the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request, obtain the function name of the third-party application corresponding to the processing request, query the program information of the preset host application according to the function name of the third-party application, and obtain the function pointer address of the third-party application corresponding to the processing request.
[0140] In one embodiment, the function construction module is further configured to generate mapping address information corresponding to the function pointer address based on the function pointer address, and obtain the initialization function based on the third-party application function class and the mapping address information.
[0141] In one embodiment, the assignment module is further configured to obtain the third-party application function class name and the third-party application function name corresponding to the processing request, and fill the initialization function with the third-party application function class name, the third-party application function name, and the function parameters to obtain the target function.
[0142] In one embodiment, the calling module is further configured to call the target function, obtain the function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function, jump to the function of the third-party application according to the function pointer address, execute the function, and the function is used to process the request according to the function parameters in the target function.
[0143] For specific limitations regarding the SDK invocation device, please refer to the limitations on the SDK invocation method above, which will not be repeated here. Each module in the aforementioned SDK invocation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can invoke and execute the operations corresponding to each module.
[0144] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements an SDK invocation method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0145] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0146] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0147] Receive processing requests carrying functional parameters;
[0148] Based on the processing request, query the SDK information of the preset third-party application, obtain the third-party application function class corresponding to the processing request, perform a non-empty check on the third-party application function class, and obtain the check result;
[0149] When the judgment result is not empty, obtain the function pointer address of the third-party application corresponding to the processing request according to the processing request;
[0150] The initialization function is obtained based on the function class and function pointer address of the third-party application;
[0151] The target function is obtained by assigning values to the initialization function based on the function parameters.
[0152] Call the target function to process the request.
[0153] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0154] Based on the processing request, query the SDK information of the preset third-party application to obtain the function class name of the third-party application corresponding to the processing request;
[0155] Based on the third-party application function class name, obtain the third-party application function class corresponding to the request.
[0156] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0157] The program information of the preset host application is queried based on the function class of the third-party application;
[0158] When the program information contains class information corresponding to the functional class of a third-party application, the judgment result is non-empty.
[0159] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0160] When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request to obtain the function name of the third-party application corresponding to the processing request;
[0161] The program information of the default host application is queried based on the function name of the third-party application, and the function pointer address of the third-party application corresponding to the processing request is obtained.
[0162] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0163] Based on the function pointer address, generate the mapping address information corresponding to the function pointer address;
[0164] The initialization function is obtained based on the third-party application's function class and mapping address information.
[0165] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0166] Get and process the name of the third-party application function class and the name of the third-party application function corresponding to the request;
[0167] The target function is obtained by filling in the initialization function with the third-party application's function class name, function name, and function parameters.
[0168] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0169] Call the target function and obtain the function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function;
[0170] The system jumps to the function pointer address of the third-party application and executes the function. The function is used to process the request according to the function parameters in the target function.
[0171] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0172] Receive processing requests carrying functional parameters;
[0173] Based on the processing request, query the SDK information of the preset third-party application, obtain the third-party application function class corresponding to the processing request, perform a non-empty check on the third-party application function class, and obtain the check result;
[0174] When the judgment result is not empty, obtain the function pointer address of the third-party application corresponding to the processing request according to the processing request;
[0175] The initialization function is obtained based on the function class and function pointer address of the third-party application;
[0176] The target function is obtained by assigning values to the initialization function based on the function parameters.
[0177] Call the target function to process the request.
[0178] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0179] Based on the processing request, query the SDK information of the preset third-party application to obtain the function class name of the third-party application corresponding to the processing request;
[0180] Based on the third-party application function class name, obtain the third-party application function class corresponding to the request.
[0181] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0182] The program information of the preset host application is queried based on the function class of the third-party application;
[0183] When the program information contains class information corresponding to the functional class of a third-party application, the judgment result is non-empty.
[0184] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0185] When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request to obtain the function name of the third-party application corresponding to the processing request;
[0186] The program information of the default host application is queried based on the function name of the third-party application, and the function pointer address of the third-party application corresponding to the processing request is obtained.
[0187] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0188] Based on the function pointer address, generate the mapping address information corresponding to the function pointer address;
[0189] The initialization function is obtained based on the third-party application's function class and mapping address information.
[0190] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0191] Get and process the name of the third-party application function class and the name of the third-party application function corresponding to the request;
[0192] The target function is obtained by filling in the initialization function with the third-party application's function class name, function name, and function parameters.
[0193] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0194] Call the target function and obtain the function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function;
[0195] The system jumps to the function pointer address of the third-party application and executes the function. The function is used to process the request according to the function parameters in the target function.
[0196] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0197] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0198] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. An SDK invocation method, characterized in that, The method includes: Receive a processing request initiated by a mini-program, carrying functional parameters; the processing request refers to a request to call a third-party application SDK to implement a function; the functional parameters are used to indicate the storage location of the data to be processed; Based on the processing request, query the SDK information of a third-party application that is preset independently of the host application to obtain the third-party application function class corresponding to the processing request. Perform a non-empty check on the third-party application function class to detect whether the third-party application function class exists in the current host application environment and obtain the judgment result. When the determination result indicates that the third-party application function class exists in the host application environment, the function pointer address of the third-party application corresponding to the processing request is obtained according to the processing request; when the determination result is not empty, it indicates that the third-party application function class exists in the host application; the function pointer address refers to the address of the third-party application SDK function that implements the function in the host application. An initialization function is obtained based on the third-party application's function class and the function pointer address; the initialization function refers to an unassigned function that has a mapping relationship with the function pointer address. The initialization function is assigned values according to the function parameters to obtain the target function; The target function is invoked so that the function pointer address mapped by the target function can be used to directly jump to and execute the third-party application SDK function in the host application, thereby processing the processing request according to the function parameters.
2. The method according to claim 1, characterized in that, The step of querying the SDK information of a third-party application, which is independent of the host application and preset according to the processing request, to obtain the functional class of the third-party application corresponding to the processing request includes: Based on the processing request, query the SDK information of a third-party application that is preset independently of the host application to obtain the function class name of the third-party application corresponding to the processing request; Based on the third-party application function class name, the third-party application function class corresponding to the processing request is obtained.
3. The method according to claim 1, characterized in that, The step of performing a non-empty check on the third-party application function class to detect whether the third-party application function class exists in the current host application's environment and obtaining the check result includes: The program information of the preset host application is queried according to the function class of the third-party application; When the program information contains class information corresponding to the functional class of the third-party application, the judgment result is non-empty.
4. The method according to claim 1, characterized in that, When the determination result indicates that the third-party application function class exists in the host application environment, the process of obtaining the function pointer address of the third-party application corresponding to the processing request, based on the processing request, includes: When the determination result indicates that the third-party application function class exists in the host application environment, the SDK information of the preset third-party application is queried according to the processing request to obtain the third-party application function name corresponding to the processing request; Based on the function name of the third-party application, query the program information of the preset host application to obtain the function pointer address of the third-party application corresponding to the processing request.
5. The method according to claim 1, characterized in that, The step of obtaining the initialization function based on the third-party application function class and the function pointer address includes: Based on the function pointer address, generate mapping address information corresponding to the function pointer address; The initialization function is obtained based on the third-party application function class and the mapping address information.
6. The method according to claim 1, characterized in that, The step of assigning values to the initialization function according to the function parameters to obtain the target function includes: Obtain the class name and function name of the third-party application corresponding to the processing request; The initialization function is populated with the third-party application function class name, the third-party application function name, and the function parameters to obtain the target function.
7. An SDK invocation device, characterized in that, The device includes: The receiving module is used to receive processing requests initiated by the mini-program, carrying functional parameters; the processing request refers to a request to call a third-party application SDK to implement a function; the functional parameters are used to indicate the storage location of the data to be processed; The class acquisition module is used to query the SDK information of a third-party application that is preset independently of the host application according to the processing request, obtain the third-party application function class corresponding to the processing request, perform a non-empty check on the third-party application function class to detect whether the third-party application function class exists in the environment of the current host application, and obtain the judgment result. The address acquisition module is used to acquire the function pointer address of the third-party application corresponding to the processing request when the judgment result indicates that the third-party application function class exists in the host application environment; when the judgment result is not empty, it indicates that the third-party application function class exists in the host application; the function pointer address refers to the address of the third-party application SDK function that implements the function in the host application. The function construction module is used to obtain the initialization function based on the third-party application function class and the function pointer address; The assignment module is used to assign values to the initialization function according to the function parameters to obtain the target function; the initialization function refers to the unassigned function that has a mapping relationship with the function pointer address; The calling module is used to call the target function, so as to directly jump to and execute the third-party application SDK function in the host application through the function pointer address mapped by the target function, thereby processing the processing request according to the function parameters.
8. The apparatus according to claim 7, characterized in that, The class acquisition module is specifically used for: Based on the processing request, query the SDK information of a third-party application that is pre-defined and independent of the host application to obtain the function class name of the third-party application corresponding to the processing request; based on the function class name of the third-party application, obtain the function class of the third-party application corresponding to the processing request.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Interface invocation method and device , computer device and storage medium
CN109445845A