CN111666116A - SDK calling method and device, computer equipment and storage medium - Google Patents
SDK calling method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN111666116A CN111666116A CN202010460845.4A CN202010460845A CN111666116A CN 111666116 A CN111666116 A CN 111666116A CN 202010460845 A CN202010460845 A CN 202010460845A CN 111666116 A CN111666116 A CN 111666116A
- Authority
- CN
- China
- Prior art keywords
- function
- party application
- processing request
- class
- information
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
本申请涉及过程优化技术领域,提供了一种SDK调用方法、装置、计算机设备和存储介质。所述方法包括:接收携带功能参数的处理请求;根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果;当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址;根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数;根据功能参数对初始化功能函数进行赋值,得到目标功能函数;调用目标功能函数,处理处理请求。采用本方法能够使小程序SDK正常实现对处理请求的处理。
The present application relates to the technical field of process optimization, and provides an SDK calling method, apparatus, computer equipment and storage medium. The method includes: receiving a processing request carrying function parameters; querying the SDK information of a preset third-party application program according to the processing request, obtaining a third-party application program function class corresponding to the processing request, and performing a non-null operation on the third-party application program function class. Judgment, get the judgment result; when the judgment result is not empty, obtain the function function pointer address of the third-party application corresponding to the processing request according to the processing request; obtain the initialization function according to the third-party application function class and function function pointer address function; assign values to the initialization function function according to the function parameters to obtain the target function function; call the target function function to process the processing request. By using this method, the applet SDK can normally realize the processing of the processing request.
Description
技术领域technical field
本申请涉及计算机技术领域,特别是涉及一种SDK调用方法、装置、计算机设备和存储介质。The present application relates to the field of computer technology, and in particular, to a method, apparatus, computer device and storage medium for invoking an SDK.
背景技术Background technique
随着计算机技术的发展,出现了小程序SDK(Software Development Kit,软件开发工具包),目前的小程序SDK需要依托于宿主应用程序实现调用第三方应用程序SDK的功能,如分享内容至第三方应用程序、调用第三方应用程序解压文件等。With the development of computer technology, the applet SDK (Software Development Kit, software development kit) has appeared. The current applet SDK needs to rely on the host application to realize the function of calling third-party application SDK, such as sharing content to third parties applications, calling third-party applications to decompress files, etc.
传统方法中,在小程序SDK依托于宿主应用程序实现调用第三方应用程序SDK的功能时,需要宿主应用程序提供第三方应用程序SDK的类与方法,通过小程序SDK导入提供的类,进行函数调用来实现功能,或者由宿主应用程序提供一些代理,小程序SDK设置代理,让宿主应用程序帮忙实现功能。In the traditional method, when the applet SDK relies on the host application to realize the function of calling the third-party application SDK, the host application needs to provide the classes and methods of the third-party application SDK, and import the provided classes through the applet SDK to perform the function. Call to implement the function, or the host application provides some proxies, and the applet SDK sets the proxy to let the host application help implement the function.
然而,传统方法由于需要宿主应用程序提供第三方应用程序SDK的类与方法或者代理,对宿主应用程序的依赖性强,一旦宿主应用程序没有办法提供第三方应用程序SDK的类与方法或者代理,小程序SDK将无法正常实现相应功能。However, the traditional method relies heavily on the host application because the host application needs to provide the classes and methods or proxies of the third-party application SDK. Once the host application cannot provide the classes and methods or proxies of the third-party application SDK, The Mini Program SDK will not be able to implement the corresponding functions normally.
发明内容SUMMARY OF THE INVENTION
基于此,有必要针对上述技术问题,提供一种能够让小程序SDK正常实现功能的SDK调用方法、装置、计算机设备和存储介质。Based on this, it is necessary to provide an SDK calling method, apparatus, computer device and storage medium that can enable the applet SDK to normally realize the functions in response to the above technical problems.
一种SDK调用方法,所述方法包括:An SDK calling method, the method includes:
接收携带功能参数的处理请求;Receive processing requests carrying functional parameters;
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果;Query the SDK information of the preset third-party application according to the processing request, obtain the function class of the third-party application corresponding to the processing request, and perform a non-empty judgment on the function class of the third-party application to obtain the judgment result;
当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址;When the judgment result is not empty, obtain the function function pointer address of the third-party application corresponding to the processing request according to the processing request;
根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数;According to the third-party application function class and function function pointer address, the initialization function function is obtained;
根据功能参数对初始化功能函数进行赋值,得到目标功能函数;Assign values to the initialization function function according to the function parameters to obtain the target function function;
调用目标功能函数,处理处理请求。Call the target function function to process the processing request.
在一个实施例中,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类包括:In one embodiment, querying the SDK information of the preset third-party application according to the processing request, and obtaining the function class of the third-party application corresponding to the processing request includes:
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类名;Query the SDK information of the preset third-party application according to the processing request, and obtain the function class name of the third-party application corresponding to the processing request;
根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类。According to the function class name of the third-party application, the function class of the third-party application corresponding to the processing request is obtained.
在一个实施例中,对第三方应用程序功能类进行非空判断,得到判断结果包括:In one embodiment, the non-empty judgment is performed on the third-party application function class, and the judgment result obtained includes:
根据第三方应用程序功能类对预设宿主应用程序的程序信息进行查询;Query the program information of the preset host application according to the third-party application function class;
当程序信息中存在与第三方应用程序功能类对应的类信息时,得到判断结果为非空。When there is class information corresponding to the function class of the third-party application program in the program information, the obtained judgment result is not empty.
在一个实施例中,当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址包括:In one embodiment, when the judgment result is not empty, according to the processing request, obtaining the function function pointer address of the third-party application corresponding to the processing request includes:
当判断结果为非空时,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能函数名;When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request, and 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 function name of the third-party application, and obtain the function function pointer address of the third-party application corresponding to the processing request.
在一个实施例中,根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数包括:In one embodiment, according to the third-party application function class and the function function pointer address, obtaining the initialization function function includes:
根据功能函数指针地址,生成与功能函数指针地址对应的映射地址信息;According to the function function pointer address, the mapping address information corresponding to the function function pointer address is generated;
根据第三方应用程序功能类和映射地址信息,得到初始化功能函数。According to the third-party application function class and mapping address information, the initialization function function is obtained.
在一个实施例中,根据功能参数对初始化功能函数进行赋值,得到目标功能函数包括:In one embodiment, assigning values to the initialization function function according to the function parameters, and obtaining the target function function includes:
获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名;Obtain the third-party application function class name and third-party application function function name corresponding to the processing request;
根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对初始化功能函数进行填充,得到目标功能函数。Fill the initialization function function according to the function class name of the third-party application program, the function function name of the third-party application program, and the function parameters to obtain the target function function.
在一个实施例中,调用目标功能函数,处理处理请求包括:In one embodiment, calling the target function function, and processing the processing request includes:
调用目标功能函数,通过目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址;Call the target function function, and obtain the function function pointer address of the third-party application program corresponding to the address mapping information through the address mapping information in the target function function;
根据功能函数指针地址跳转至第三方应用程序的功能函数,执行功能函数,功能函数用于根据目标功能函数中的功能参数处理处理请求。Jump to the function function of the third-party application program according to the function function pointer address, execute the function function, and the function function is used to process the processing request according to the function parameter in the target function function.
一种SDK调用装置,所述装置包括:An SDK calling device, the device includes:
接收模块,用于接收携带功能参数的处理请求;a receiving module for receiving a processing request carrying functional parameters;
类获取模块,用于根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果;The class acquisition module is used to query the SDK information of the preset third-party application according to the processing request, obtain the function class of the third-party application corresponding to the processing request, and perform a non-empty judgment on the function class of the third-party application to obtain the judgment result;
地址获取模块,用于当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址;The address obtaining module is used to obtain the function function pointer address of the third-party application corresponding to the processing request according to the processing request when the judgment result is not empty;
函数构建模块,用于根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数;The function building module is used to obtain the initialization function function according to the third-party application function class and function function pointer address;
赋值模块,用于根据功能参数对初始化功能函数进行赋值,得到目标功能函数;The assignment module is used to assign values to the initialization function function according to the function parameters to obtain the target function function;
调用模块,用于调用目标功能函数,处理处理请求。The calling module is used to call the target function function and process the processing request.
一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:A computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
接收携带功能参数的处理请求;Receive processing requests carrying functional parameters;
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果;Query the SDK information of the preset third-party application according to the processing request, obtain the function class of the third-party application corresponding to the processing request, and perform a non-empty judgment on the function class of the third-party application to obtain the judgment result;
当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址;When the judgment result is not empty, obtain the function function pointer address of the third-party application corresponding to the processing request according to the processing request;
根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数;According to the third-party application function class and function function pointer address, the initialization function function is obtained;
根据功能参数对初始化功能函数进行赋值,得到目标功能函数;Assign values to the initialization function function according to the function parameters to obtain the target function function;
调用目标功能函数,处理处理请求。Call the target function function to process the processing request.
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
接收携带功能参数的处理请求;Receive processing requests carrying functional parameters;
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果;Query the SDK information of the preset third-party application according to the processing request, obtain the function class of the third-party application corresponding to the processing request, and perform a non-empty judgment on the function class of the third-party application to obtain the judgment result;
当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址;When the judgment result is not empty, obtain the function function pointer address of the third-party application corresponding to the processing request according to the processing request;
根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数;According to the third-party application function class and function function pointer address, the initialization function function is obtained;
根据功能参数对初始化功能函数进行赋值,得到目标功能函数;Assign values to the initialization function function according to the function parameters to obtain the target function function;
调用目标功能函数,处理处理请求。Call the target function function to process the processing request.
上述SDK调用方法、装置、计算机设备和存储介质,利用SDK信息得到与处理请求对应的第三方应用程序功能类,并对第三方应用程序功能类进行非空判断,在判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址,根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数,根据功能参数对初始化功能函数进行赋值,得到目标功能函数,调用目标功能函数,处理处理请求,整个过程,利用第三方应用程序功能类、功能函数指针地址以及功能参数,实现了对目标功能函数的获取,从而可以通过调用目标功能函数,实现对处理请求的处理,在处理过程中不需要导入宿主应用程序的类与方法或利用宿主应用程序提供的代理,能够在宿主应用程序没有办法提供第三方应用程序的类与方法或者代理时,使小程序SDK正常实现对处理请求的处理。The above SDK calling method, device, computer equipment and storage medium use the SDK information to obtain the third-party application function class corresponding to the processing request, and perform a non-empty judgment on the third-party application function class. When the judgment result is non-empty, According to the processing request, obtain the function function pointer address of the third-party application corresponding to the processing request, obtain the initialization function function according to the third-party application function class and function function pointer address, and assign the initialization function function according to the function parameters to obtain the target Function function, calling the target function function, processing the processing request, the whole process, using the third-party application function class, function function pointer address and function parameters to achieve the acquisition of the target function function, so that the target function function can be called by calling the target function function. When processing requests, it is not necessary to import the classes and methods of the host application or use the proxies provided by the host application in the process of processing. The program SDK normally implements the processing of processing requests.
附图说明Description of drawings
图1为一个实施例中SDK调用方法的流程示意图;Fig. 1 is the schematic flow chart of SDK calling method in one embodiment;
图2为另一个实施例中SDK调用方法的流程示意图;Fig. 2 is the schematic flow chart of SDK calling method in another embodiment;
图3为一个实施例中SDK调用装置的结构框图;Fig. 3 is the structural block diagram of the SDK calling device in one embodiment;
图4为一个实施例中计算机设备的内部结构图。FIG. 4 is a diagram of the internal structure of a computer device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
在一个实施例中,如图1所示,提供了一种SDK调用方法,本实施例以该方法应用于终端进行举例说明,可以理解的是,该方法也可以应用于服务器,还可以应用于包括终端和服务器的系统,并通过终端和服务器的交互实现。本实施例中,该方法包括以下步骤:In one embodiment, as shown in FIG. 1 , a method for invoking an SDK is provided. In this embodiment, the method is applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a terminal. A system including a terminal and a server, and is realized through the interaction of the terminal and the server. In this embodiment, the method includes the following steps:
步骤102,接收携带功能参数的处理请求。Step 102: Receive a processing request carrying function parameters.
其中,处理请求是指调用第三方应用程序SDK实现功能的请求,比如,处理请求具体可以是分享内容至第三方应用程序。又比如,处理请求具体可以是调用第三方应用程序解压文件。功能参数是指待处理参数,与处理请求对应。比如,当处理请求为分享内容至第三方应用程序时,功能参数具体可以是待分享内容的URL(Uniform Resource Locator,统一资源定位符)地址。又比如,当处理请求为调用第三方应用程序解压文件时,功能参数具体可以是待解压文件的文件路径。The processing request refers to a request for invoking a third-party application SDK to implement a function. For example, the processing request may specifically be sharing content to a third-party application. For another example, the processing request may specifically be calling a third-party application to decompress the file. The function parameter refers to the parameter to be processed, which corresponds to the processing request. For example, when the processing request is to share content to a third-party application, the function parameter may specifically be a URL (Uniform Resource Locator) address of the content to be shared. For another example, when the processing request is to call a third-party application to decompress the file, the function parameter may specifically be the file path of the to-be-decompressed file.
具体的,当用户想要通过终端中的宿主应用程序中的小程序SDK调用第三方应用程序SDK的功能时,会通过操作小程序SDK发送携带功能参数的处理请求至小程序SDK。Specifically, when the user wants to invoke the functions of the third-party application SDK through the applet SDK in the host application in the terminal, a processing request carrying the function parameters is sent to the applet SDK by operating the applet SDK.
步骤104,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果。Step 104 , query the SDK information of the preset third-party application program according to the processing request, obtain the third-party application program function class corresponding to the processing request, and perform a non-empty judgment on the third-party application program function class to obtain a judgment result.
其中,预设第三方应用程序的SDK信息是指与小程序SDK对应的、第三方应用程序开源的SDK信息,包括第三方应用程序SDK的类名称与功能的对应关系信息以及函数名与功能的对应关系信息。类是面向对象程序设计实现信息封装的基础,是一种用户定义的引用数据类型,也称类类型。每个类包含数据说明和一组操作数据或传递消息的函数。与处理请求对应的第三方应用程序功能类是指用于实现与处理请求对应的功能的类。比如,当处理请求为分享内容至第三方应用程序时,与处理请求对应的第三方应用程序功能类具体可以是第三方应用程序用于实现分享的类。又比如,当处理请求为调用第三方应用程序解压文件时,与处理请求对应的第三方应用程序功能类具体可以是第三方应用程序用于实现解压的类。The preset SDK information of the third-party application refers to the open-source SDK information of the third-party application corresponding to the applet SDK, including information on the correspondence between the class name and function of the third-party application SDK, and the relationship between the function name and function. Correspondence information. Class is the basis for object-oriented programming to realize information encapsulation. It is a user-defined reference data type, also called class type. Each class contains data descriptions and a set of functions that manipulate data or pass messages. The third-party application function class corresponding to the processing request refers to a class for implementing the function corresponding to the processing request. For example, when the processing request is to share content to a third-party application, the third-party application function class corresponding to the processing request may specifically be a class used by the third-party application to implement sharing. For another example, when the processing request is to call a third-party application to decompress the file, the third-party application function class corresponding to the processing request may specifically be a class used by the third-party application to implement decompression.
其中,对第三方应用程序功能类进行非空判断,是指判断第三方应用程序功能类是否存在于宿主应用程序中,若存在,说明宿主应用程序拥有实现相应功能的能力,则小程序SDK可以实现相应功能,若不存在,说明宿主应用程序不能实现相应功能,则小程序SDK不能实现相应功能。比如,当处理请求为分享内容至第三方应用程序时,若对应的第三方应用程序功能类存在于宿主应用程序中,说明宿主应用程序拥有分享的能力,若对应的第三方应用程序功能类不存在于宿主应用程序中,说明无法分享,即无法实现相应的功能,会触发相应的保护机制,不执行后续操作。Among them, the non-empty judgment of the third-party application function class refers to judging whether the third-party application function class exists in the host application. If it exists, it means that the host application has the ability to realize the corresponding function. Implement the corresponding function. If it does not exist, it means that the host application cannot implement the corresponding function, and the applet SDK cannot implement the corresponding function. For example, when the processing request is to share content to a third-party application, if the corresponding third-party application function class exists in the host application, it means that the host application has the ability to share. If the corresponding third-party application function class does not If it exists in the host application, it means that it cannot be shared, that is, the corresponding function cannot be realized, and the corresponding protection mechanism will be triggered, and subsequent operations will not be performed.
具体的,终端中的小程序SDK会根据处理请求查询预设第三方应用程序的SDK信息,从预设第三方应用程序的SDK信息中,查找到实现与处理请求对应的功能的类名字符串,通过类名字符串动态生成与处理请求对应的第三方应用程序功能类。举例说明,可通过Objective-C语言根据类名字符串动态生成与处理请求对应的第三方应用程序功能类。在生成与处理请求对应的第三方应用程序功能类后,终端中的小程序SDK会利用预设宿主应用程序的程序信息对第三方应用程序功能类进行非空判断,判断其是否存在于宿主应用程序中,得到判断结果。Specifically, the applet SDK in the terminal will query the SDK information of the preset third-party application according to the processing request, and find the class name string that implements the function corresponding to the processing request from the SDK information of the preset third-party application. , and dynamically generate the third-party application function class corresponding to the processing request through the class name string. For example, the third-party application function class corresponding to the processing request can be dynamically generated according to the class name string through the Objective-C language. After generating the third-party application function class corresponding to the processing request, the applet SDK in the terminal will use the program information of the preset host application to perform a non-empty judgment on the third-party application function class to determine whether it exists in the host application. In the program, the judgment result is obtained.
步骤106,当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址。Step 106, when the judgment result is not empty, obtain the function function pointer address of the third-party application corresponding to the processing request according to the processing request.
其中,功能函数指针地址是指在宿主应用程序中实现与处理请求对应的功能的第三方应用程序SDK函数地址。The function function pointer address refers to the third-party application SDK function address that implements the function corresponding to the processing request in the host application.
具体的,当判断结果为非空时,说明宿主应用程序拥有实现相应功能的能力,即小程序SDK可以实现相应功能,终端中的小程序SDK会根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能函数名,再根据第三方应用程序功能函数名去获取与处理请求对应的第三方应用程序的功能函数指针地址。Specifically, when the judgment result is not empty, it means that the host application has the ability to realize the corresponding function, that is, the applet SDK can realize the corresponding function, and the applet SDK in the terminal will query the SDK of the preset third-party application according to the processing request information, obtain the function function name of the third-party application program corresponding to the processing request, and then obtain the function function pointer address of the third-party application program corresponding to the processing request according to the function function name of the third-party application program.
步骤108,根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数。Step 108: Obtain an initialization function function according to the third-party application function class and the function function pointer address.
其中,初始化功能函数是指与功能函数指针地址有映射关系的未赋值功能函数。The initialization function function refers to an unassigned function function that has a mapping relationship with the function function pointer address.
具体的,终端中的小程序SDK会根据功能函数指针地址,生成与功能函数指针地址对应的映射地址信息,再根据第三方应用程序功能类和映射地址信息,得到初始化功能函数。Specifically, the applet SDK in the terminal will generate mapping address information corresponding to the function function pointer address according to the function function pointer address, and then obtain the initialization function function according to the third-party application function class and mapping address information.
步骤110,根据功能参数对初始化功能函数进行赋值,得到目标功能函数。Step 110: Assign values to the initialization function function according to the function parameters to obtain the target function function.
其中,目标功能函数是指与功能函数指针地址有映射关系的已赋值功能函数。The target function function refers to an assigned function function that has a mapping relationship with the function function pointer address.
具体的,终端中的小程序SDK会获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名,根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对初始化功能函数进行填充,得到目标功能函数。Specifically, the applet SDK in the terminal will obtain the third-party application function class name and the third-party application function function name corresponding to the processing request. The parameter fills the initialization function function to obtain the target function function.
步骤112,调用目标功能函数,处理处理请求。Step 112, calling the target function function to process the processing request.
具体的,终端中的小程序SDK通过调用目标功能函数,能够通过目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址,进而根据该功能函数指针地址跳转至第三方应用程序的功能函数,通过执行功能函数,实现根据目标功能函数中的功能参数处理处理请求。Specifically, by calling the target function function, the applet SDK in the terminal can obtain the function function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function function, and then according to the function function pointer address Jump to the function function of the third-party application, and implement the processing request according to the function parameters in the target function function by executing the function function.
上述SDK调用方法,利用SDK信息得到与处理请求对应的第三方应用程序功能类,并对第三方应用程序功能类进行非空判断,在判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址,根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数,根据功能参数对初始化功能函数进行赋值,得到目标功能函数,调用目标功能函数,处理处理请求,整个过程,利用第三方应用程序功能类、功能函数指针地址以及功能参数,实现了对目标功能函数的获取,从而可以通过调用目标功能函数,实现对处理请求的处理,在处理过程中不需要导入宿主应用程序的类与方法或利用宿主应用程序提供的代理,能够在宿主应用程序没有办法提供第三方应用程序的类与方法或者代理时,使小程序SDK正常实现对处理请求的处理。The above SDK calling method uses the SDK information to obtain the third-party application function class corresponding to the processing request, and judges that the third-party application function class is not empty. When the judgment result is not empty, obtain and process the request according to the processing request. The function function pointer address of the corresponding third-party application program, according to the third-party application program function class and function function pointer address, the initialization function function is obtained, the initialization function function is assigned according to the function parameters, the target function function is obtained, and the target function function is called, In the whole process of processing the processing request, the third-party application function class, function function pointer address and function parameters are used to obtain the target function function, so that the processing request can be processed by calling the target function function. It is not necessary to import the classes and methods of the host application or use the proxies provided by the host application, so that the applet SDK can normally realize the request processing function when the host application cannot provide the classes, methods or proxies of the third-party application. deal with.
在一个实施例中,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类包括:In one embodiment, querying the SDK information of the preset third-party application according to the processing request, and obtaining the function class of the third-party application corresponding to the processing request includes:
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类名;Query the SDK information of the preset third-party application according to the processing request, and obtain the function class name of the third-party application corresponding to the processing request;
根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类。According to the function class name of the third-party application, the function class of the third-party application corresponding to the processing request is obtained.
其中,第三方应用程序功能类名就是指用于实现与处理请求对应的功能的类的名称。比如,第三方应用程序功能类名具体可以是表示类的字符串。The third-party application function class name refers to the name of the class used to implement the function corresponding to the processing request. For example, the function class name of the third-party application may specifically be a string representing the class.
具体的,处理请求是与功能对应的,终端中的小程序SDK在接收到处理请求后,会确定处理请求想要调用的功能,根据处理请求想要调用的功能去查询预设第三方应用程序的SDK信息,在预设第三方应用程序的SDK信息中包括类名称与功能的对应关系信息,这个信息是可以从第三方应用程序开源的SDK数据获取到的,通过查询类名称与功能的对应关系信息,就可以得到与处理请求对应的第三方应用程序功能类名,进而根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类。Specifically, the processing request corresponds to the function. After receiving the processing request, the applet SDK in the terminal will determine the function to be called by the processing request, and query the preset third-party application according to the function to be called by the processing request. The SDK information of the default third-party application includes the correspondence information between the class name and the function. This information can be obtained from the open-source SDK data of the third-party application. By querying the correspondence between the class name and the function relationship information, the function class name of the third-party application program corresponding to the processing request can be obtained, and then the function class of the third-party application program corresponding to the processing request can be obtained according to the function class name of the third-party application program.
进一步的,处理请求中会携带功能标识,功能标识用于表征想要调用的功能,小程序SDK通过根据功能标识去查询预设第三方应用程序的SDK信息,就能得到与处理请求对应的第三方应用程序功能类名。根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类的方式可以为利用Objective-C语言动态生成。Further, the processing request will carry a function identifier, which is used to represent the function to be called, and the applet SDK can obtain the third-party application corresponding to the processing request by querying the SDK information of the preset third-party application according to the function identifier. Third-party application function class name. According to the function class name of the third-party application, the method of obtaining the function class of the third-party application corresponding to the processing request may be dynamically generated by using the Objective-C language.
本实施例中,通过处理请求,得到与处理请求对应的第三方应用程序功能类名,根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类,能够实现对第三方应用程序功能类的获取。In this embodiment, the function class name of the third-party application program corresponding to the processing request is obtained by processing the request, and the function class of the third-party application program corresponding to the processing request is obtained according to the function class name of the third-party application program. The acquisition of the application function class.
在一个实施例中,对第三方应用程序功能类进行非空判断,得到判断结果包括:In one embodiment, the non-empty judgment is performed on the third-party application function class, and the judgment result obtained includes:
根据第三方应用程序功能类对预设宿主应用程序的程序信息进行查询;Query the program information of the preset host application according to the third-party application function class;
当程序信息中存在与第三方应用程序功能类对应的类信息时,得到判断结果为非空。When there is class information corresponding to the function class of the third-party application program in the program information, the obtained judgment result is not empty.
其中,预设宿主应用程序的程序信息是指宿主应用程序运行的代码信息。Wherein, the program information of the preset host application refers to the code information of the running of the host application.
具体的,终端中的小程序SDK会根据第三方应用程序功能类对预设宿主应用程序的程序信息进行查询,查询程序信息中是否有对应的类信息。在预设宿主应用程序的程序信息中包括集成的第三方应用程序的类,当程序信息中存在与第三方应用程序功能类对应的类信息时,表示宿主应用程序拥有实现相应功能的能力,得到判断结果为非空。Specifically, the applet SDK in the terminal will query the program information of the preset host application according to the function class of the third-party application, and check whether there is corresponding class information in the program information. The class of the integrated third-party application is included in the program information of the preset host application. When there is class information corresponding to the function class of the third-party application in the program information, it means that the host application has the ability to realize the corresponding function. The judgment result is not empty.
本实施例中,通过查询预设宿主应用程序的程序信息中是否有与第三方应用程序功能类对应的类信息,能实现对第三方应用程序功能类的非空判断。In this embodiment, by querying whether there is class information corresponding to the function class of the third-party application program in the program information of the preset host application, the non-empty judgment of the function class of the third-party application program can be realized.
在一个实施例中,当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址包括:In one embodiment, when the judgment result is not empty, according to the processing request, obtaining the function function pointer address of the third-party application corresponding to the processing request includes:
当判断结果为非空时,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能函数名;When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request, and 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 function name of the third-party application, and obtain the function function pointer address of the third-party application corresponding to the processing request.
其中,第三方应用程序功能函数名是指第三方应用程序功能函数的名称。比如,第三方应用程序功能函数名具体可以是表示功能函数的字符串。The third-party application function function name refers to the name of the third-party application function function. For example, the name of the function function of the third-party application may specifically be a character string representing the function function.
具体的,当判断结果为非空时,终端中的小程序SDK会根据处理请求去查询预设第三方应用程序的SDK信息,在预设第三方应用程序的SDK信息中包括函数名与功能的对应关系信息,这个信息是可以从第三方应用程序开源的SDK数据获取到的,通过查询函数名与功能的对应关系信息,就可以得到与处理请求对应的第三方应用程序功能函数名,进而根据第三方应用程序功能函数名查询预设宿主应用程序的程序信息,获取与处理请求对应的第三方应用程序的功能函数指针地址。Specifically, when the judgment result is not empty, the applet SDK in the terminal will query the SDK information of the preset third-party application according to the processing request, and the SDK information of the preset third-party application includes the function name and the function name. Correspondence information. This information can be obtained from the open source SDK data of third-party applications. By querying the correspondence information between function names and functions, the function name of the third-party application corresponding to the processing request can be obtained. The third-party application function function name queries the program information of the preset host application, and obtains the function function pointer address of the third-party application corresponding to the processing request.
进一步的,处理请求中会携带功能标识,功能标识用于表征想要调用的功能,小程序SDK通过根据功能标识去查询预设第三方应用程序的SDK信息,就能得到与处理请求对应的第三方应用程序功能函数名。根据第三方应用程序功能函数名查询预设宿主应用程序的程序信息,就可以从程序信息中查找到功能函数代码段,进而从功能函数代码中获取与处理请求对应的第三方应用程序的功能函数指针地址。Further, the processing request will carry a function identifier, which is used to represent the function to be called, and the applet SDK can obtain the third-party application corresponding to the processing request by querying the SDK information of the preset third-party application according to the function identifier. Three-party application function function name. By querying the program information of the preset host application according to the function function name of the third-party application, the function code segment can be found from the program information, and then the function function of the third-party application corresponding to the processing request can be obtained from the function function code. pointer address.
本实施例中,通过处理请求,得到与处理请求对应的第三方应用程序功能函数名,根据第三方应用程序功能函数名查询预设宿主应用程序的程序信息,获取与处理请求对应的第三方应用程序的功能函数指针地址,能够实现对功能函数指针地址的获取。In this embodiment, the function name of the third-party application program corresponding to the processing request is obtained by processing the request, the program information of the preset host application is queried according to the function function name of the third-party application program, and the third-party application corresponding to the processing request is obtained. The function function pointer address of the program can realize the acquisition of the function function pointer address.
在一个实施例中,根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数包括:In one embodiment, according to the third-party application function class and the function function pointer address, obtaining the initialization function function includes:
根据功能函数指针地址,生成与功能函数指针地址对应的映射地址信息;According to the function function pointer address, the mapping address information corresponding to the function function pointer address is generated;
根据第三方应用程序功能类和映射地址信息,得到初始化功能函数。According to the third-party application function class and mapping address information, the initialization function function is obtained.
其中,映射地址信息用于对功能函数指针地址进行映射。The mapping address information is used to map the function function pointer address.
具体的,终端中的小程序SDK会根据功能函数指针地址,生成与功能函数指针地址对应的映射地址信息,通过该映射地址信息可以跳转到功能函数指针地址,以执行功能函数。在得到映射地址信息后,终端中的小程序SDK会根据第三方应用程序功能类和映射地址信息,得到初始化功能函数,在初始化功能函数中并未赋参数值、功能类名以及功能函数名。进一步的,终端中的小程序SDK可通过利用Objective-C语言得到初始化功能函数。Specifically, the applet SDK in the terminal will generate mapping address information corresponding to the function function pointer address according to the function function pointer address, and the function function pointer address can be jumped to by the mapping address information to execute the function function. After obtaining the mapping address information, the applet SDK in the terminal will obtain the initialization function function according to the third-party application function class and mapping address information. The parameter value, function class name and function function name are not assigned in the initialization function function. Further, the applet SDK in the terminal can obtain the initialization function by using the Objective-C language.
本实施例中,通过功能函数指针地址,生成与功能函数指针地址对应的映射地址信息,根据第三方应用程序功能类和映射地址信息,得到初始化功能函数,能够实现对初始化功能函数的获取。In this embodiment, the mapping address information corresponding to the function function pointer address is generated through the function function pointer address, and the initialization function function is obtained according to the third-party application program function class and mapping address information, which can realize the acquisition of the initialization function function.
在一个实施例中,根据功能参数对初始化功能函数进行赋值,得到目标功能函数包括:In one embodiment, assigning values to the initialization function function according to the function parameters, and obtaining the target function function includes:
获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名;Obtain the third-party application function class name and third-party application function function name corresponding to the processing request;
根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对初始化功能函数进行填充,得到目标功能函数。Fill the initialization function function according to the function class name of the third-party application program, the function function name of the third-party application program, and the function parameters to obtain the target function function.
具体的,终端中的小程序SDK可通过根据处理请求查询预设第三方应用程序的SDK信息的方式,获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名,进而识别初始化功能函数中分别与第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对应的待填充字段,根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对待填充字段进行填充,得到目标功能函数。Specifically, the applet SDK in the terminal can obtain the third-party application function class name and the third-party application function function name corresponding to the processing request by querying the SDK information of the preset third-party application according to the processing request, and then Identify the fields to be filled corresponding to the third-party application function class name, third-party application function function name, and function parameters in the initialization function function, according to the third-party application function class name, third-party application function function name, and function parameters. Fill the fields to be filled to obtain the target function function.
本实施例中,通过获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名,根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对初始化功能函数进行填充,得到目标功能函数,能够实现对目标功能函数的获取。In this embodiment, by acquiring the third-party application function class name and the third-party application function function name corresponding to the processing request, the initialization function is initialized according to the third-party application function class name, the third-party application function function name, and the function parameters. The function is filled to obtain the target function function, which can realize the acquisition of the target function function.
在一个实施例中,调用目标功能函数,处理处理请求包括:In one embodiment, calling the target function function, and processing the processing request includes:
调用目标功能函数,通过目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址;Call the target function function, and obtain the function function pointer address of the third-party application program corresponding to the address mapping information through the address mapping information in the target function function;
根据功能函数指针地址跳转至第三方应用程序的功能函数,执行功能函数,功能函数用于根据目标功能函数中的功能参数处理处理请求。Jump to the function function of the third-party application program according to the function function pointer address, execute the function function, and the function function is used to process the processing request according to the function parameter in the target function function.
具体的,终端中的小程序SDK会调用目标功能函数,通过目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址,根据功能函数指针地址跳转至第三方应用程序的功能函数,执行功能函数,实现根据目标功能函数中的功能参数处理处理请求。Specifically, the applet SDK in the terminal will call the target function function, obtain the function function pointer address of the third-party application corresponding to the address mapping information through the address mapping information in the target function function, and jump to the function pointer address according to the function function pointer address. The function function of the third-party application program, executes the function function, and realizes the processing request according to the function parameters in the target function function.
本实施例中,通过调用目标功能函数,实现根据目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址,进而根据功能函数指针地址跳转至第三方应用程序的功能函数,执行功能函数,能够实现根据目标功能函数中的功能参数处理处理请求。In this embodiment, by calling the target function function, according to the address mapping information in the target function function, the function function pointer address of the third-party application program corresponding to the address mapping information is obtained, and then jumping to the third party according to the function function pointer address The function function of the application program executes the function function, and can realize the processing request according to the function parameters in the target function function.
如图2所示,通过一个实施例来说明本申请的SDK调用方法,包括以下步骤:As shown in Figure 2, an embodiment is used to illustrate the SDK calling method of the present application, including the following steps:
步骤202,接收携带功能参数的处理请求;Step 202, receiving a processing request carrying functional parameters;
步骤204,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类名;Step 204, query the SDK information of the preset third-party application program according to the processing request, and obtain the function class name of the third-party application program corresponding to the processing request;
步骤206,根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类;Step 206, obtaining a third-party application function class corresponding to the processing request according to the third-party application function class name;
步骤208,根据第三方应用程序功能类对预设宿主应用程序的程序信息进行查询;Step 208, query the program information of the preset host application according to the third-party application function class;
步骤210,当程序信息中存在与第三方应用程序功能类对应的类信息时,得到判断结果为非空;Step 210, when there is class information corresponding to the third-party application program function class in the program information, the obtained judgment result is non-empty;
步骤212,当判断结果为非空时,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能函数名;Step 212, when the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request, and obtain the function name of the third-party application corresponding to the processing request;
步骤214,根据第三方应用程序功能函数名查询预设宿主应用程序的程序信息,获取与处理请求对应的第三方应用程序的功能函数指针地址;Step 214, query the program information of the preset host application according to the function function name of the third-party application, and obtain the function function pointer address of the third-party application corresponding to the processing request;
步骤216,根据功能函数指针地址,生成与功能函数指针地址对应的映射地址信息;Step 216, according to the function function pointer address, generate mapping address information corresponding to the function function pointer address;
步骤218,根据第三方应用程序功能类和映射地址信息,得到初始化功能函数;Step 218, obtain the initialization function function according to the third-party application program function class and the mapping address information;
步骤220,获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名;Step 220, obtaining the third-party application function class name and the third-party application function function name corresponding to the processing request;
步骤222,根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对初始化功能函数进行填充,得到目标功能函数;Step 222, fill in the initialization function function according to the third-party application program function class name, the third-party application program function function name and the function parameter to obtain the target function function;
步骤224,调用目标功能函数,通过目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址;Step 224, calling the target function function, and obtaining the function function pointer address of the third-party application program corresponding to the address mapping information through the address mapping information in the target function function;
步骤226,根据功能函数指针地址跳转至第三方应用程序的功能函数,执行功能函数,功能函数用于根据目标功能函数中的功能参数处理处理请求。Step 226 , jump to the function function of the third-party application program according to the function function pointer address, execute the function function, and the function function is used for processing the processing request according to the function parameter in the target function function.
应该理解的是,虽然图1-2的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图1-2中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flowcharts of FIGS. 1-2 are shown in sequence according to the arrows, these steps are not necessarily executed in the sequence shown by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in FIGS. 1-2 may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution of these steps or stages The order is also not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the steps or phases within the other steps.
在一个实施例中,如图3所示,提供了一种SDK调用装置,包括:接收模块302、类获取模块304、地址获取模块306、函数构建模块308、赋值模块310和调用模块312,其中:In one embodiment, as shown in FIG. 3, an SDK calling device is provided, including: a receiving
接收模块302,用于接收携带功能参数的处理请求;a
类获取模块304,用于根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果;The
地址获取模块306,用于当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址;The
函数构建模块308,用于根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数;The
赋值模块310,用于根据功能参数对初始化功能函数进行赋值,得到目标功能函数;The
调用模块312,用于调用目标功能函数,处理处理请求。The calling
上述SDK调用装置,利用SDK信息得到与处理请求对应的第三方应用程序功能类,并对第三方应用程序功能类进行非空判断,在判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址,根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数,根据功能参数对初始化功能函数进行赋值,得到目标功能函数,调用目标功能函数,处理处理请求,整个过程,利用第三方应用程序功能类、功能函数指针地址以及功能参数,实现了对目标功能函数的获取,从而可以通过调用目标功能函数,实现对处理请求的处理,在处理过程中不需要导入宿主应用程序的类与方法或利用宿主应用程序提供的代理,能够在宿主应用程序没有办法提供第三方应用程序的类与方法或者代理时,使小程序SDK正常实现对处理请求的处理。The above SDK calling device obtains the third-party application function class corresponding to the processing request by using the SDK information, and judges that the third-party application function class is not empty, and when the judgment result is not empty, obtains and processes the request according to the processing request The function function pointer address of the corresponding third-party application program, according to the third-party application program function class and function function pointer address, the initialization function function is obtained, the initialization function function is assigned according to the function parameters, the target function function is obtained, and the target function function is called, In the whole process of processing the processing request, the third-party application function class, function function pointer address and function parameters are used to obtain the target function function, so that the processing request can be processed by calling the target function function. It is not necessary to import the classes and methods of the host application or use the proxies provided by the host application, so that the applet SDK can normally realize the request processing function when the host application cannot provide the classes, methods or proxies of the third-party application. deal with.
在一个实施例中,类获取模块还用于根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类名,根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类。In one embodiment, the class obtaining module is further configured to query the SDK information of the preset third-party application according to the processing request, obtain the function class name of the third-party application corresponding to the processing request, and obtain the function class name of the third-party application according to the function class name of the third-party application. The third-party application function class corresponding to the processing request.
在一个实施例中,类获取模块还用于根据第三方应用程序功能类对预设宿主应用程序的程序信息进行查询,当程序信息中存在与第三方应用程序功能类对应的类信息时,得到判断结果为非空。In one embodiment, the class acquisition module is further configured to query the program information of the preset host application according to 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, obtain The judgment result is not empty.
在一个实施例中,地址获取模块还用于当判断结果为非空时,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能函数名,根据第三方应用程序功能函数名查询预设宿主应用程序的程序信息,获取与处理请求对应的第三方应用程序的功能函数指针地址。In one embodiment, the address obtaining module is further configured to query the SDK information of the preset third-party application program according to the processing request when the judgment result is not empty, and obtain the function function name of the third-party application program corresponding to the processing request. The function name of the third-party application program queries the program information of the preset host application program, and obtains the function function pointer address of the third-party application program corresponding to the processing request.
在一个实施例中,函数构建模块还用于根据功能函数指针地址,生成与功能函数指针地址对应的映射地址信息,根据第三方应用程序功能类和映射地址信息,得到初始化功能函数。In one embodiment, the function building module is further configured to generate mapping address information corresponding to the function function pointer address according to the function function pointer address, and obtain the initialization function function according to the third-party application function class and the mapping address information.
在一个实施例中,赋值模块还用于获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名,根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对初始化功能函数进行填充,得到目标功能函数。In one embodiment, the assignment module is further configured to obtain the third-party application function class name and the third-party application function function name corresponding to the processing request, according to the third-party application function class name, the third-party application function function name and The function parameter fills the initialization function function to obtain the target function function.
在一个实施例中,调用模块还用于调用目标功能函数,通过目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址,根据功能函数指针地址跳转至第三方应用程序的功能函数,执行功能函数,功能函数用于根据目标功能函数中的功能参数处理处理请求。In one embodiment, the calling module is further configured to call the target function function, obtain the function function pointer address of the third-party application program corresponding to the address mapping information through the address mapping information in the target function function, and jump according to the function function pointer address To the function function of the third-party application, the function function is executed, and the function function is used to process the processing request according to the function parameters in the target function function.
关于SDK调用装置的具体限定可以参见上文中对于SDK调用方法的限定,在此不再赘述。上述SDK调用装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific limitation of the SDK invoking device, please refer to the limitation of the SDK invocation method above, which will not be repeated here. Each module in the above-mentioned SDK calling device may be implemented in whole or in part by software, hardware and combinations thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图4所示。该计算机设备包括通过系统总线连接的处理器、存储器、通信接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的通信接口用于与外部的终端进行有线或无线方式的通信,无线方式可通过WIFI、运营商网络、NFC(近场通信)或其他技术实现。该计算机程序被处理器执行时以实现一种SDK调用方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。In one embodiment, a computer device is provided, and the computer device may be a terminal, and its internal structure diagram may be as shown in FIG. 4 . The computer equipment includes a processor, memory, a communication interface, a display screen, and an input device connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The nonvolatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for wired or wireless communication with an external terminal, and the wireless communication can be realized by WIFI, operator network, NFC (Near Field Communication) or other technologies. The computer program implements an SDK calling method when executed by the processor. The display screen of the computer equipment may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment may be a touch layer covered on the display screen, or a button, a trackball or a touchpad set on the shell of the computer equipment , or an external keyboard, trackpad, or mouse.
本领域技术人员可以理解,图4中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 4 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现以下步骤:In one embodiment, a computer device is provided, including a memory and a processor, a computer program is stored in the memory, and the processor implements the following steps when executing the computer program:
接收携带功能参数的处理请求;Receive processing requests carrying functional parameters;
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果;Query the SDK information of the preset third-party application according to the processing request, obtain the function class of the third-party application corresponding to the processing request, and perform a non-empty judgment on the function class of the third-party application to obtain the judgment result;
当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址;When the judgment result is not empty, obtain the function function pointer address of the third-party application corresponding to the processing request according to the processing request;
根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数;According to the third-party application function class and function function pointer address, the initialization function function is obtained;
根据功能参数对初始化功能函数进行赋值,得到目标功能函数;Assign values to the initialization function function according to the function parameters to obtain the target function function;
调用目标功能函数,处理处理请求。Call the target function function to process the processing request.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类名;Query the SDK information of the preset third-party application according to the processing request, and obtain the function class name of the third-party application corresponding to the processing request;
根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类。According to the function class name of the third-party application, the function class of the third-party application corresponding to the processing request is obtained.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
根据第三方应用程序功能类对预设宿主应用程序的程序信息进行查询;Query the program information of the preset host application according to the third-party application function class;
当程序信息中存在与第三方应用程序功能类对应的类信息时,得到判断结果为非空。When there is class information corresponding to the function class of the third-party application program in the program information, the obtained judgment result is not empty.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
当判断结果为非空时,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能函数名;When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request, and 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 function name of the third-party application, and obtain the function function pointer address of the third-party application corresponding to the processing request.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
根据功能函数指针地址,生成与功能函数指针地址对应的映射地址信息;According to the function function pointer address, the mapping address information corresponding to the function function pointer address is generated;
根据第三方应用程序功能类和映射地址信息,得到初始化功能函数。According to the third-party application function class and mapping address information, the initialization function function is obtained.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名;Obtain the third-party application function class name and third-party application function function name corresponding to the processing request;
根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对初始化功能函数进行填充,得到目标功能函数。Fill the initialization function function according to the function class name of the third-party application program, the function function name of the third-party application program, and the function parameters to obtain the target function function.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor further implements the following steps when executing the computer program:
调用目标功能函数,通过目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址;Call the target function function, and obtain the function function pointer address of the third-party application program corresponding to the address mapping information through the address mapping information in the target function function;
根据功能函数指针地址跳转至第三方应用程序的功能函数,执行功能函数,功能函数用于根据目标功能函数中的功能参数处理处理请求。Jump to the function function of the third-party application program according to the function function pointer address, execute the function function, and the function function is used to process the processing request according to the function parameter in the target function function.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:In one embodiment, a computer-readable storage medium is provided on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
接收携带功能参数的处理请求;Receive processing requests carrying functional parameters;
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类,对第三方应用程序功能类进行非空判断,得到判断结果;Query the SDK information of the preset third-party application according to the processing request, obtain the function class of the third-party application corresponding to the processing request, and perform a non-empty judgment on the function class of the third-party application to obtain the judgment result;
当判断结果为非空时,根据处理请求,获取与处理请求对应的第三方应用程序的功能函数指针地址;When the judgment result is not empty, obtain the function function pointer address of the third-party application corresponding to the processing request according to the processing request;
根据第三方应用程序功能类和功能函数指针地址,得到初始化功能函数;According to the third-party application function class and function function pointer address, the initialization function function is obtained;
根据功能参数对初始化功能函数进行赋值,得到目标功能函数;Assign values to the initialization function function according to the function parameters to obtain the target function function;
调用目标功能函数,处理处理请求。Call the target function function to process the processing request.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program further implements the following steps when executed by the processor:
根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能类名;Query the SDK information of the preset third-party application according to the processing request, and obtain the function class name of the third-party application corresponding to the processing request;
根据第三方应用程序功能类名,得到与处理请求对应的第三方应用程序功能类。According to the function class name of the third-party application, the function class of the third-party application corresponding to the processing request is obtained.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program further implements the following steps when executed by the processor:
根据第三方应用程序功能类对预设宿主应用程序的程序信息进行查询;Query the program information of the preset host application according to the third-party application function class;
当程序信息中存在与第三方应用程序功能类对应的类信息时,得到判断结果为非空。When there is class information corresponding to the function class of the third-party application program in the program information, the obtained judgment result is not empty.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program further implements the following steps when executed by the processor:
当判断结果为非空时,根据处理请求查询预设第三方应用程序的SDK信息,得到与处理请求对应的第三方应用程序功能函数名;When the judgment result is not empty, query the SDK information of the preset third-party application according to the processing request, and 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 function name of the third-party application, and obtain the function function pointer address of the third-party application corresponding to the processing request.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program further implements the following steps when executed by the processor:
根据功能函数指针地址,生成与功能函数指针地址对应的映射地址信息;According to the function function pointer address, the mapping address information corresponding to the function function pointer address is generated;
根据第三方应用程序功能类和映射地址信息,得到初始化功能函数。According to the third-party application function class and mapping address information, the initialization function function is obtained.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program further implements the following steps when executed by the processor:
获取与处理请求对应的第三方应用程序功能类名以及第三方应用程序功能函数名;Obtain the third-party application function class name and third-party application function function name corresponding to the processing request;
根据第三方应用程序功能类名、第三方应用程序功能函数名以及功能参数对初始化功能函数进行填充,得到目标功能函数。Fill the initialization function function according to the function class name of the third-party application program, the function function name of the third-party application program, and the function parameters to obtain the target function function.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program further implements the following steps when executed by the processor:
调用目标功能函数,通过目标功能函数中的地址映射信息,得到与地址映射信息对应的第三方应用程序的功能函数指针地址;Call the target function function, and obtain the function function pointer address of the third-party application program corresponding to the address mapping information through the address mapping information in the target function function;
根据功能函数指针地址跳转至第三方应用程序的功能函数,执行功能函数,功能函数用于根据目标功能函数中的功能参数处理处理请求。Jump to the function function of the third-party application program according to the function function pointer address, execute the function function, and the function function is used to process the processing request according to the function parameter in the target function function.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to memory, storage, database or other media used in the various embodiments provided in this application may include at least one of non-volatile and volatile memory. The non-volatile memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, and the like. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, the RAM may be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM).
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features It is considered to be the range described in this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are specific and detailed, but should not be construed as a limitation on the scope of the invention patent. It should be noted that, for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010460845.4A CN111666116A (en) | 2020-05-27 | 2020-05-27 | SDK calling method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010460845.4A CN111666116A (en) | 2020-05-27 | 2020-05-27 | SDK calling method and device, computer equipment and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN111666116A true CN111666116A (en) | 2020-09-15 |
Family
ID=72384855
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010460845.4A Pending CN111666116A (en) | 2020-05-27 | 2020-05-27 | SDK calling method and device, computer equipment and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111666116A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114528054A (en) * | 2022-01-19 | 2022-05-24 | 浪潮卓数大数据产业发展有限公司 | Third-party SDK initialization method, device, equipment and medium based on service module |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150339140A1 (en) * | 2014-05-23 | 2015-11-26 | Google Inc. | Application Access to Native and Bundled Libraries |
| CN109445845A (en) * | 2018-09-10 | 2019-03-08 | 深圳市智美达科技股份有限公司 | Interface call method, device, computer equipment and storage medium |
| CN109597662A (en) * | 2018-11-08 | 2019-04-09 | 百度在线网络技术(北京)有限公司 | The call method, device and electronic equipment in non-public library in mobile terminal |
-
2020
- 2020-05-27 CN CN202010460845.4A patent/CN111666116A/en active Pending
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150339140A1 (en) * | 2014-05-23 | 2015-11-26 | Google Inc. | Application Access to Native and Bundled Libraries |
| CN109445845A (en) * | 2018-09-10 | 2019-03-08 | 深圳市智美达科技股份有限公司 | Interface call method, device, computer equipment and storage medium |
| CN109597662A (en) * | 2018-11-08 | 2019-04-09 | 百度在线网络技术(北京)有限公司 | The call method, device and electronic equipment in non-public library in mobile terminal |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114528054A (en) * | 2022-01-19 | 2022-05-24 | 浪潮卓数大数据产业发展有限公司 | Third-party SDK initialization method, device, equipment and medium based on service module |
| CN114528054B (en) * | 2022-01-19 | 2024-05-10 | 浪潮卓数大数据产业发展有限公司 | Third party SDK initialization method, device, equipment and medium based on service module |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108255615B (en) | Calling methods, servers and storage media across languages | |
| CN108055248B (en) | Dubbo framework-based remote calling method, server and storage medium | |
| CA2980772C (en) | Endpoint management system providing an application programming interface proxy service | |
| CN105593813B (en) | A rendering interpreter for visualizing data served from constrained environment containers | |
| CN103677922B (en) | The method and apparatus started to application software | |
| JP7106001B2 (en) | SUB-APPLICATION DEVELOPMENT METHOD, APPARATUS, COMPUTER DEVICE, AND COMPUTER PROGRAM | |
| WO2020151333A1 (en) | Page loading method, apparatus, computer device and storage medium | |
| US10536559B2 (en) | Blocking an interface of a redirected USB composite device | |
| CN105159786A (en) | Method and device for inter-process communication | |
| CN111399833B (en) | Service data processing method and device, computer equipment and storage medium | |
| WO2016058488A1 (en) | Method and device for providing sdk files | |
| CN111464487A (en) | Access control method, device and system | |
| CN114531477A (en) | Method and device for configuring functional components, computer equipment and storage medium | |
| CN110175464A (en) | Data access control method, device, storage medium and electronic device | |
| CN107748689B (en) | Webpage display method and device | |
| CN112235132A (en) | Method, device, medium and server for dynamically configuring service | |
| CN111666116A (en) | SDK calling method and device, computer equipment and storage medium | |
| CN115756483A (en) | Compiling method, compiling apparatus, computer device, and storage medium | |
| US11017032B1 (en) | Document recovery utilizing serialized data | |
| CN111581578B (en) | Interface request processing method and device | |
| CN110413423B (en) | Data processing method, related device, equipment and storage medium | |
| CN112527416A (en) | Task processing method and device, computer equipment and storage medium | |
| US12001458B2 (en) | Multi-cloud object store access | |
| WO2021248310A1 (en) | Method and apparatus for acquiring service calling information, and vulnerability test method for service | |
| US12244672B2 (en) | Cloud data ingestion system |
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 |