Application running method and related equipment

By reading the routing protocol data from the APP's executable file and registering the routing table at the kernel layer, it solves the problems of slow startup and registration lag caused by manual management of routing tables, realizes automatic registration of routing tables, and improves application performance. Startup efficiency and reliability.

CN118656138APending Publication Date: 2024-09-17MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410384701.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

In the existing technology, the registration process of the routing table relies on manual management, which leads to problems in cross-module usage scenarios. The registration speed is slow, affecting the startup speed of the APP, and may even cause the routing table to be loaded before the APP is started. Affect user experience.

Method used

By reading the routing protocol data from the APP's executable file, the routing table is generated, and the running function is loaded after the operating system enters the kernel layer, and the routing table is registered in advance to avoid the situation where the routing table has not been registered and the APP is started, and realizes automatic registration. .

Benefits of technology

Ensure that the routing table is registered before the application running function is loaded, which improves the startup efficiency of the application, saves labor costs, realizes the automatic registration of the routing table, and improves the startup speed and reliability of the application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656138A
    Figure CN118656138A
Patent Text Reader

Abstract

The embodiment of the invention discloses an application running method and related equipment. The application running method comprises the following steps: in response to a starting instruction of a first application, reading routing protocol data of the first application from an executable file of the first application; the routing protocol data comprises a component routing protocol of a service component of the first application; the executable file is a binary file; generating a routing table of the first application according to the routing protocol data; and loading a running function in the executable file, and running the first application according to the component routing protocol and the running function in the routing table. According to the application, automatic registration of the routing table can be realized, and the starting efficiency of the application is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of application development technology, and in particular to an application operation method and related equipment. Background Art

[0002] In the process of APP (Application) component development, routing is a common solution to solve the communication between components. At present, in the process of registering the routing table, the developer usually manually manages the routing protocol (such as the routing protocol between components, the jump protocol between APPs, etc.) for each business module in the application to complete the registration of the routing table. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide an application running method and related equipment to realize automatic registration of routing tables and improve the startup efficiency of applications.

[0004] To solve the above technical problems, the embodiments of the present application are implemented as follows:

[0005] On the one hand, an embodiment of the present application provides an application running method, including:

[0006] In response to a start instruction of a first application, reading routing protocol data of the first application from an executable file of the first application; the routing protocol data includes a component routing protocol of a service component of the first application;

[0007] generating a routing table for the first application according to the routing protocol data;

[0008] The running function in the executable file is loaded, and the first application is run according to the component routing protocol and the running function in the routing table.

[0009] On the other hand, an embodiment of the present application provides an application running device, including:

[0010] A reading module, configured to read routing protocol data of the first application from an executable file of the first application in response to a startup instruction of the first application; the routing protocol data includes a component routing protocol of a service component of the first application;

[0011] A generating module, configured to generate a routing table for the first application according to the routing protocol data;

[0012] A running module is used to load the running function in the executable file and run the first application according to the component routing protocol and the running function in the routing table.

[0013] On the other hand, an embodiment of the present application provides an electronic device, including a processor and a memory electrically connected to the processor, the memory storing a computer program, and the processor being used to call and execute the computer program from the memory to implement the above-mentioned application running method.

[0014] On the other hand, an embodiment of the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program can be executed by a processor to implement the above-mentioned application running method.

[0015] On the other hand, an embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the above-mentioned application running method.

[0016] The technical solution of the embodiment of the present application is adopted, by reading the routing protocol data of the first application from the executable file of the first application, generating the routing table of the first application according to the routing protocol data, and then loading the running function in the executable file, and running the first application according to the component routing protocol and running function in the routing table. It can be seen that since the executable file can read the routing protocol data in the executable file after the operating system enters the kernel layer, without waiting until entering the user layer (i.e., the application layer), the timing of reading the routing protocol data is advanced, ensuring that the routing table has been generated before the running function in the executable file of the first application is loaded, so that the registration timing of the routing table is before the running function of the first application is loaded, thereby avoiding the situation where the routing table has not been registered yet but the first application has been started, ensuring the smooth operation of the first application. In addition, since the routing protocol data includes the component routing protocols of the business components of the first application, after responding to the startup instruction of the first application, by triggering the action of reading the routing protocol data from the executable file, the component routing protocols of all business components can be read at one time, without the developer having to manually compile the corresponding routing protocol reading code for each business component. Therefore, when there are many business components in the first application, the labor cost in the registration process of the routing table can be greatly saved, the automatic registration effect of the routing table is achieved, and the startup efficiency of the first application is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate one or more embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in one or more embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1is a schematic flow chart of an application running method according to an embodiment of the present application;

[0019] Figure 2 is a schematic flow chart of an application running method according to another embodiment of the present application;

[0020] Figure 3 is a schematic structural diagram of an executable file in an application running method according to an embodiment of the present application;

[0021] Figure 4 is a schematic flow chart of an application running method according to yet another embodiment of the present application;

[0022] Figure 5 is a schematic block diagram of an application running device according to an embodiment of the present application;

[0023] Figure 6 It is a schematic block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0024] The embodiments of the present application provide an application running method and related devices to achieve the automatic registration effect of the routing table and improve the startup efficiency of the application.

[0025] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0026] In the process of registering the routing table, the registration of the routing table is usually completed by manually managing the routing protocol (such as the routing protocol between components, the jump protocol between APPs, etc.). For example, the application includes multiple business modules such as business module 1 and business module 2. The developer needs to manually compile the routing protocol reading code of business module 1, the routing protocol reading code of business module 2, etc. After the application loads the main function, the routing protocol reading code of business module 1 is executed to read the routing protocol of business module 1, and the routing table registration of business module 1 is completed, and the routing protocol reading code of business module 2 is executed to read the routing protocol of business module 2, and the routing table registration of business module 2 is completed. This method is not a big problem in a single module, but in the cross-module usage scenario, it is easy to go wrong because it requires multiple people to assist in the modification. In addition, based on the method of manually managing the routing protocol, the routing protocol reading code of each business module needs to be called separately to generate their own routing tables, so the registration speed of the routing table is slow, resulting in a relatively delayed registration of the routing table, thereby affecting the startup speed of the APP, and there may even be a situation where the routing table has not been loaded yet, but the APP has been started, which in turn causes application failures and poor user experience.

[0027] To address this issue, the related art uses a method of loading a routing table from a json file or a plist file to complete the registration of the routing table. However, since both json files and plist files belong to application layer files, reading data from a json file or a plist file is equivalent to reading data at the application layer. It can be understood that when an electronic device installs or starts an APP, it first enters the kernel layer to load the kernel layer file, and then enters the application layer to load the application layer file, that is, the data reading timing of the application layer lags behind the data reading timing of the kernel layer. If the routing table is loaded from a json file or a plist file, the routing table can only be loaded after entering the application layer, so it will still cause a delay in the registration timing of the routing table, affecting the startup speed of the APP.

[0028] The application running method provided in the embodiment of the present application reads the routing protocol data of the first application from the executable file of the first application (i.e., APP), generates a routing table of the first application based on the routing protocol data, and then loads the running function in the executable file, and runs the first application based on the component routing protocol and running function in the routing table.

[0029] For example, in the iOS operating system, the executable file of the APP is a Mach-O file. The routing protocol data can be written into the Mach-O file in advance, so that when the APP is started, the routing protocol data can be read from the Mach-O file to register the routing table. Since the Mach-O file is a binary file, and the reading of the binary file is performed at the kernel layer, as long as the APP starts to start, it can trigger the reading of the routing protocol data in the Mach-O file at the kernel layer, so that the registration time of the routing table is advanced. It can be seen that since the executable file can read the routing protocol data in the executable file after the operating system enters the kernel layer, without waiting to read it after entering the user layer (i.e., the application layer), the timing of reading the routing protocol data is advanced, ensuring that the routing table has been generated before the running function in the executable file of the first application is loaded, so that the registration time of the routing table is before the running function of the first application is loaded, thereby avoiding the situation where the routing table has not been registered yet and the first application has been started, ensuring the smooth operation of the first application.

[0030] In addition, since the routing protocol data includes the component routing protocols of the business components of the first application, after responding to the startup instruction of the first application, by triggering the action of reading the routing protocol data from the executable file, the component routing protocols of all business components can be read at one time, without the need for developers to manually compile the corresponding routing protocol reading code for each business component. Therefore, when there are many business components in the first application, the labor cost in the registration process of the routing table can be greatly saved, the automation effect of routing table registration is achieved, and the startup efficiency of the first application is improved.

[0031] The application running method provided in the embodiment of the present application can be executed by an electronic device, or by software installed in the electronic device. Specifically, the electronic device can be a terminal device or a server device. Among them, the terminal device can include a smart phone, a laptop computer, a smart wearable device, a vehicle terminal, etc., and the server device can include an independent physical server, a server cluster composed of multiple servers, or a cloud server capable of cloud computing.

[0032] Figure 1 is a schematic flow chart of an application running method according to an embodiment of the present application, such as Figure 1 As shown, the method includes:

[0033] S102, in response to a start instruction of the first application, reading routing protocol data of the first application from an executable file of the first application; the routing protocol data includes a component routing protocol of a service component of the first application.

[0034] The first application may be any application that needs to be developed. The routing protocol data is pre-written into the executable file of the first application so that the routing protocol data can be quickly read when the first application is started.

[0035] An executable file is a binary file. An executable file refers to a piece of code that can be executed or a file used to start an application, such as an installation package file of an application. In some operating systems, the binary file is read after the operating system enters the kernel layer, that is, the binary file is read in the kernel layer of the operating system. Taking the operating system corresponding to the first application as the iOS operating system as an example, the executable file of the first application is a Mach-O file. The Mach-O file has the characteristic of data segment read and write. The Mach-O file can store related data through the data segment, such as code, character constants, classes, methods, etc. The data stored in the data segment is readable and writable. Therefore, the routing protocol data of the first application can be pre-written into the Mach-O file, so that when the first application is started, the routing protocol data of the first application is read from the Mach-O file.

[0036] The routing protocol data may include multiple specified fields and mapping relationships between the specified fields, and the specified fields include at least one of a component routing protocol, an implementation class, and a routing address. In the mapping relationship of the routing protocol data, the component routing protocol is a program framework for communication between the business components of the first application, and the routing address is a link address for calling between the business components, which may be in the form of a URL (Universal Resource Locator) string, i.e., a URL String. The component may call the specified code through the routing address. The implementation class is used to define a method for instantiating the routing protocol data. According to the implementation class in the routing protocol data, the routing protocol data may be instantiated without the need to instantiate the routing protocol data by other programs or devices.

[0037] S104: Generate a routing table for the first application according to the routing protocol data.

[0038] This step is the instantiation process of the routing protocol data. Optionally, firstly, according to the implementation class in the routing protocol data, the instantiation implementation method of the routing protocol data is determined, and then based on the instantiation implementation method, the routing protocol data is instantiated to obtain the routing table of the first application.

[0039] S106, loading the running function in the executable file, and running the first application according to the component routing protocol and the running function in the routing table.

[0040] The running function in the executable file may include the main function of the first application. It can be seen that the routing protocol data of the first application has been read before the main function of the first application is loaded, and the registration time of the routing table is advanced.

[0041] In this embodiment, in order to ensure that the routing protocol data is read in the kernel layer of the operating system, an initialization function of the first application can be predefined, and the function pointer of the initialization function points to the routing protocol data. After entering the kernel layer of the operating system, the initialization function of the first application is first called, and then the routing protocol data is read from the executable file based on the initialization function. The definition method of the initialization function will be described in detail in the following embodiments.

[0042] The application running method provided in this embodiment can be applied to component development scenarios of various applications, including scenarios where users install applications for the first time. For example, when a user installs a first application from an application store, the installation package of the first application is first downloaded to the terminal device, and then the first application is installed based on the installation package. The installation package is the executable file of the first application. When the first application is started for the first time, the routing protocol data is first read from the installation package of the first application, a routing table is generated based on the routing protocol data, and then the running function in the installation package is loaded, and the first application is run based on the routing table and the running function.

[0043] The technical solution of the embodiment of the present application is adopted, by reading the routing protocol data of the first application from the executable file of the first application, generating the routing table of the first application according to the routing protocol data, and then loading the running function in the executable file, and running the first application according to the component routing protocol and running function in the routing table. It can be seen that since the executable file can read the routing protocol data in the executable file after the operating system enters the kernel layer, without waiting until entering the user layer (i.e., the application layer), the timing of reading the routing protocol data is advanced, ensuring that the routing table has been generated before the running function in the executable file of the first application is loaded, so that the registration timing of the routing table is before the running function of the first application is loaded, thereby avoiding the situation where the routing table has not been registered yet but the first application has been started, ensuring the smooth operation of the first application. In addition, since the routing protocol data includes the component routing protocols of the business components of the first application, after responding to the startup instruction of the first application, by triggering the action of reading the routing protocol data from the executable file, the component routing protocols of all business components can be read at one time, without the developer having to manually compile the corresponding routing protocol reading code for each business component. Therefore, when there are many business components in the first application, the labor cost in the registration process of the routing table can be greatly saved, the automatic registration effect of the routing table is achieved, and the startup efficiency of the first application is improved.

[0044] In one embodiment, before executing step S102, the routing protocol data of the first application needs to be pre-written into the executable file. Optionally, the specified fields included in the routing protocol data are defined by macro definition, the specified fields include the component routing protocol, implementation class and routing address of the business component, and a mapping relationship between the specified fields is created, so that the specified fields and the mapping relationship between them are written into the executable file.

[0045] Optionally, only one line of macro definition needs to be written in the pre-compilation stage to complete the definition process of the specified field. For example, the macro definition is: Router_REGISTER(PROTOCOL_NAME,IMPLCLASS_NAME,SCHEME), where PROTOCOL_NAME refers to the name of the component routing protocol, IMPLCLASS_NAME refers to the name of the implementation class, and SCHEME is the routing address.

[0046] Therefore, this embodiment writes the routing protocol data into the executable file through macro definition, so that during the operation of the first application, only one line of macro definition code needs to be called to complete the dynamic jump of the page. Compared with the method of writing a large number of repetitive controller jump codes in the prior art, the calling process of this embodiment is very simple and fast, reducing a lot of repetitive work.

[0047] In one embodiment, when reading the routing protocol data of the first application from the executable file of the first application, the initialization function of the first application is first called, and the function pointer of the initialization function points to the routing protocol data. Then, based on the initialization function, the routing protocol data is read from the executable file.

[0048] The initialization function is obtained by defining the attributes of the read function in the executable file of the first application. The function pointer of the read function points to the routing protocol data, that is, the function of the read function is to read the routing protocol data pre-stored in the executable file.

[0049] Optionally, before starting the first application, a read function for reading routing protocol data is obtained, and then based on the attribute definition mechanism provided by the development tool of the first application, the attribute definition of the read function is performed to obtain an initialization function. Furthermore, the initialization function is encapsulated by macro definition.

[0050] An optional attribute definition method is: obtaining a first identifier for characterizing an attribute of an initialization function; adding the first identifier to a specified position of a read function based on an attribute definition mechanism provided by a development tool of a first application to obtain an initialization function. The function of the attribute definition mechanism may include instructing a compiler to perform certain advanced operations, such as adding attributes to a function declaration, modifying a variable or a structure member with specific attributes, and so on.

[0051] Taking the first application as an application installed on the iOS operating system (hereinafter referred to as the iOS application) as an example, the development tool of the iOS application may be Objective-C (an object-oriented programming language that extends C), and Objective-C has a property definition mechanism: the _attribute_ mechanism. When the _attribute_ mechanism is used to define the attributes of the read function, a first identifier may be added to the specified position of the read function, for example, by adding the first identifier "_attribute_" to the specified position of the read function, an initialization function may be obtained.

[0052] The purpose of encapsulating the initialization function through macro definition is to enable any business component of the first application to call the initialization function. That is, for any business component, the initialization function can be called to read the routing protocol data in the executable file, without having to develop the function of calling the initialization function for each business component separately, which simplifies the development process of application components and improves the development efficiency of application components.

[0053] In one embodiment, when reading routing protocol data from an executable file based on an initialization function, the following steps A1-A3 may be performed:

[0054] Step A1, executing the dynamic loading callback function pre-registered in the initialization function.

[0055] Step A2, based on the dynamic loading callback function, traverse the executable file until the specified memory area in the executable file is found; the specified memory area is used to store routing protocol data.

[0056] Step A3, reading routing protocol data from the specified memory area.

[0057] In this embodiment, a dynamic loading callback function is pre-registered in the initialization function, and the dynamic loading callback function has a loop reading function, and its role is to find the routing protocol data by traversing the executable file when dynamically loading the executable file of the first application. The designated memory area is a space pre-opened in the data segment of the executable file, which is specifically used to store routing protocol data.

[0058] When reading the routing protocol data from the designated memory area, designated fields included in the routing protocol data may be read, and the designated fields include the component routing protocol, the implementation class, and the routing address of the business component.

[0059] In one embodiment, the routing protocol data includes a mapping relationship between a component routing protocol of a business component and an implementation class. The implementation class is used to define a method for instantiating the routing protocol data. The routing protocol data can be instantiated according to the implementation class in the routing protocol data.

[0060] Based on this, when generating a routing table, the implementation class of the component routing protocol of each business component can be determined based on the mapping relationship between the component routing protocol and the implementation class of the business component, and then the instantiation implementation method of the component routing protocol of each business component can be determined based on the implementation class of the component routing protocol of each business component. Then, the component routing protocol of each business component is instantiated based on the instantiation implementation method to obtain a routing table.

[0061] The following takes an iOS application as an example to explain in detail the application running method provided by this application.

[0062] Figure 2 FIG. 1 is a schematic flow chart of an application running method provided by another embodiment of the present application. In this embodiment, a method of writing routing protocol data of an iOS application into an executable file is mainly described. Figure 2 The method comprises the following steps S201-S206:

[0063] S201, defining designated fields included in routing protocol data by means of macro definition, and creating a mapping relationship between the designated fields.

[0064] The specified fields include the component routing protocol, implementation class, and routing address of the business component of the application.

[0065] The routing protocol data can be regarded as a structure, and the specified fields can be regarded as the member variables of the routing protocol data structure. The member variables of the structure include protocol (component routing protocol), implclass (implementation class) and scheme (routing address). The scheme can be in the form of a link, such as a URL string.

[0066] Optionally, only one line of macro definition needs to be written in the pre-compilation stage to complete the definition process of the specified field. For example, the macro definition is: Router_REGISTER(PROTOCOL_NAME,IMPLCLASS_NAME,SCHEME), where PROTOCOL_NAME refers to the name of the component routing protocol, IMPLCLASS_NAME refers to the name of the implementation class, and SCHEME is the routing address.

[0067] S202, obtaining a reading function for reading routing protocol data, and defining properties of the reading function through a property definition mechanism provided by an iOS application development tool to obtain an iOS application initialization function.

[0068] Among them, the function pointer of the read function points to the routing protocol data. The development tool of the ios application can be Objective-C, which has its own attribute definition mechanism: _attribute_ mechanism. When using the _attribute_ mechanism to define the attributes of the read function, the first identifier can be added to the specified position of the read function. For example, the first identifier "_attribute_" can be added to the specified position of the read function to obtain the initialization function.

[0069] After modifying the read function of the executable file based on the _attribute_ mechanism (i.e., attribute definition), it can be indicated that the function is the initialization function of the executable file. When the executable file is loaded, the initialization function will be called and executed first.

[0070] S203, encapsulate the initialization function through macro definition.

[0071] Among them, the purpose of encapsulating the initialization function through macro definition is to enable any business component of the iOS application to call the initialization function. That is, for any business component, the initialization function can be called to read the routing protocol data in the executable file, without having to develop the function of calling the initialization function for each business component separately. This simplifies the development process of iOS application components and improves the development efficiency of iOS application components.

[0072] If the iOS application includes multiple business modules, each business component can use macro definition to automatically complete the definition and writing process of routing protocol data.

[0073] S204, a space is opened in the data segment of the executable file of the iOS application, and the space is the designated memory area.

[0074] Figure 3 The file format of the executable file Mach-O of the iOS application is schematically shown. It can be seen that the Mach-O file includes a header file (Header) and data (Data). The header file (Header) stores a load command set (Load commands) for loading data (Data). The load command set (Load commands) may include multiple segment commands (Segment command), such as Figure 3 Segment command 1 and segment command 2 are shown in FIG. 1 , each segment command is used to load data in a different area. The data includes multiple data segments, such as Figure 3Segment 1 and Segment 2 are shown. Each data segment includes one or more memory areas for storing the same or different data, such as Segment 1 includes Section 1 data, Section 2 data, Section 3 data, ... Section n data, and so on. Section n data represents the data stored in Section n. For example, the space opened for routing protocol data is Section 64 (_DATA, router_map) in Segment 2. Segment instruction 1 is used to load the data stored in Segment 1, including Section 1 data, Section 2 data, and Section 3 data. Segment instruction 2 is used to load the data stored in Segment 2, including Section 4 data ... Section n data, and so on.

[0075] exist Figure 2 In the flowchart shown, the execution timing of step S204 is only an example. In actual applications, it can also be executed before step S201, between steps S201 and S202, or between steps S202 and S203. It only needs to be ensured that it is executed before writing the routing protocol data.

[0076] S205, writing the routing protocol data of the iOS application into a designated memory area in the executable file.

[0077] S206, packaging the executable file of the iOS application.

[0078] In this embodiment, based on the readable and writable characteristics of the data segment of the executable file Mach-O, the characteristics of the Mach-O file belonging to the binary file, and the attribute mechanism of Objective-C, the routing protocol data of the ios application is pre-written into the data segment of the Mach-O file, so that the ios system can first read the routing protocol data in the Mach-O file after entering the kernel layer, without waiting to read it after entering the user layer (i.e., the application layer), and advance the timing of reading the routing protocol data, ensuring that the routing table has been generated before the running function in the Mach-O file is loaded, and the registration timing of the routing table is advanced. In addition, since the routing protocol data includes the component routing protocols of each business component of the ios application, when the ios application is running, the routing protocol data of all business components can be automatically read from the Mach-O file at one time without the need for manual participation by the user, thereby achieving the automatic registration effect of the routing table. In addition, the routing protocol data is written into the executable file through macro definition, so that during the operation of the iOS application, only one line of macro definition code needs to be called to complete the dynamic jump of the page. Compared with the method of writing a large number of repetitive controller jump codes in the prior art, the calling process of this embodiment is very simple and fast, reducing a lot of repetitive work.

[0079] Figure 4 This is a schematic flow chart of an application running method provided by another embodiment of the present application. In this embodiment, it mainly describes how to quickly register a routing table when an iOS application is started. Figure 4 As shown, the following steps S401-S406 are included:

[0080] S401, in response to a startup instruction of the iOS application, calling an initialization function of the iOS application.

[0081] Among them, the initialization function of the iOS application is a read function pre-modified with the _attribute_ mechanism, and its function pointer points to the data segment where the routing protocol data is located.

[0082] S402, executing the dynamic loading callback function pre-registered in the initialization function.

[0083] Among them, the dynamic loading callback function has the function of loop reading, and its role is to find the routing protocol data by traversing the executable file when dynamically loading the executable file of the iOS application.

[0084] For example, the dynamic loading callback function is expressed as: _dyld_register_func_for_add_image(dyld_callback), where image is the general name for the files and data in the executable file.

[0085] When the dynamic loading callback function (dyld_callback function for short) is executed, if an image has been loaded, the dyld_callback function is executed once for each loaded image. After that, the dyld_callback function is executed once every time a new image is loaded to ensure that the routing protocol data in the executable file where the image is located is read.

[0086] S403, based on the dynamic loading callback function, traverse the executable file until a designated memory area in the executable file is found, and the designated memory area is used to store routing protocol data.

[0087] Optionally, the specified memory area in the executable file is searched by running the method getsectiondata in the Runtime of Object-C. Object-C is a development tool for iOS applications.

[0088] S404, reading routing protocol data from the specified memory area.

[0089] When reading routing protocol data, since routing protocol data includes component routing protocols, implementation classes and routing addresses of various business components of the iOS application, the fields where the component routing protocols, implementation classes and routing addresses are located can be directly read.

[0090] S405, instantiating the routing protocol data according to the implementation class of the routing protocol data to obtain a routing table of the iOS application.

[0091] Since the routing protocol data is in the form of a string, it cannot be used directly. Therefore, by instantiating the routing protocol data, the routing protocol data can be converted into the form of an instance class, so as to be used for the operation of the iOS application.

[0092] Optionally, the protocol class is dynamically obtained through the Object-C Runtime running method objc_getProtocol, the implementation class is dynamically obtained through objc_getClass, and the routing table registration is automatically completed through the routing address scheme.

[0093] S406, loading the running function in the executable file, and running the iOS application according to the routing table and the running function.

[0094] It can be seen that in the application running method provided by this embodiment, since the executable file of the ios application can read the routing protocol data in the executable file after the ios system enters the kernel layer, without waiting to read it after entering the user layer (i.e., the application layer), the timing of reading the routing protocol data is advanced, ensuring that the routing table has been generated before the running function in the executable file of the ios application is loaded, so that the registration timing of the routing table is before the running function of the ios application is loaded, thereby avoiding the situation where the routing table has not been registered yet but the ios application has been started, ensuring the smooth startup of the ios application. In addition, the registration process of the routing table does not require manual participation by the user, realizing the automatic registration of the routing table and improving the startup efficiency of the ios application.

[0095] In summary, specific embodiments of the present subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recorded in the claims can be performed in a different order and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing can be advantageous.

[0096] The above is an application running method provided in an embodiment of the present application. Based on the same idea, an application running device is also provided in an embodiment of the present application.

[0097] Figure 5 is a schematic block diagram of an application running device according to an embodiment of the present application, such as Figure 5 As shown, the device comprises:

[0098] A reading module 51 is used to read the routing protocol data of the first application from the executable file of the first application in response to the startup instruction of the first application; the routing protocol data includes the component routing protocol of the service component of the first application;

[0099] A generating module 52, configured to generate a routing table for the first application according to the routing protocol data;

[0100] The running module 53 is used to load the running function in the executable file and run the first application according to the component routing protocol and the running function in the routing table.

[0101] In one embodiment, when reading the routing protocol data of the first application from the executable file of the first application, the reading module 51 performs the following steps:

[0102] Calling an initialization function of the first application; a function pointer of the initialization function points to the routing protocol data;

[0103] Based on the initialization function, the routing protocol data is read from the executable file.

[0104] In one embodiment, when the reading module 51 reads the routing protocol data from the executable file based on the initialization function, the reading module 51 performs the following steps:

[0105] Execute the dynamic loading callback function pre-registered in the initialization function;

[0106] Based on the dynamic loading callback function, traverse the executable file until a specified memory area in the executable file is found; the specified memory area is used to store the routing protocol data;

[0107] The routing protocol data is read from the designated memory area.

[0108] In one embodiment, the routing protocol data further includes a mapping relationship between a component routing protocol and an implementation class of the service component;

[0109] When generating the routing table of the first application according to the routing protocol data, the generating module 52 performs the following steps:

[0110] Determine the implementation class of the component routing protocol of each business component based on the mapping relationship between the component routing protocol and the implementation class of the business component;

[0111] Determine, based on the implementation class of the component routing protocol of each business component, an instantiation implementation method of the component routing protocol of each business component;

[0112] Based on the instantiation implementation method, the component routing protocol of each business component is instantiated to obtain the routing table.

[0113] In one embodiment, the apparatus further comprises:

[0114] A field definition module, used for defining, by macro definition, specified fields included in the routing protocol data and creating a mapping relationship between the specified fields before reading the routing protocol data of the first application from the executable file of the first application in response to the startup instruction of the first application; the specified fields include the component routing protocol and implementation class of the business component;

[0115] A writing module is used to write the specified field and the mapping relationship into the executable file.

[0116] In one embodiment, the apparatus further comprises:

[0117] an acquisition module, configured to acquire a read function for reading the routing protocol data before reading the routing protocol data of the first application from the executable file of the first application in response to the startup instruction of the first application;

[0118] An attribute definition module, used to define the attributes of the read function based on the attribute definition mechanism provided by the development tool of the first application to obtain the initialization function;

[0119] The encapsulation module is used to encapsulate the initialization function through macro definition.

[0120] In one embodiment, the attribute definition module performs attribute definition on the read function in the executable file based on the attribute definition mechanism provided by the development tool of the first application, and when obtaining the initialization function, performs the following steps:

[0121] Obtaining a first identifier for characterizing a property of the initialization function;

[0122] Based on the attribute definition mechanism, the first identifier is added to a specified position of the read function to obtain the initialization function.

[0123] The device of the embodiment of the present application is adopted, by reading the routing protocol data of the first application from the executable file of the first application, generating the routing table of the first application according to the routing protocol data, and then loading the running function in the executable file, and running the first application according to the component routing protocol and running function in the routing table. It can be seen that since the executable file can read the routing protocol data in the executable file after the operating system enters the kernel layer, without waiting until entering the user layer (i.e., the application layer), the timing of reading the routing protocol data is advanced, ensuring that the routing table has been generated before the running function in the executable file of the first application is loaded, so that the registration timing of the routing table is before the running function of the first application is loaded, thereby avoiding the situation where the routing table has not been registered yet but the first application has been started, ensuring the smooth operation of the first application. In addition, since the routing protocol data includes the component routing protocols of the business components of the first application, after responding to the startup instruction of the first application, by triggering the action of reading the routing protocol data from the executable file, the component routing protocols of all business components can be read at one time, without the developer having to manually compile the corresponding routing protocol reading code for each business component. Therefore, when there are many business components in the first application, the labor cost in the registration process of the routing table can be greatly saved, the automatic registration effect of the routing table is achieved, and the startup efficiency of the first application is improved.

[0124] Those skilled in the art should understand that Figure 5The application running device in can be used to implement the application running method described above, and the detailed description thereof should be similar to the description of the method part above. To avoid tediousness, it will not be repeated here.

[0125] Based on the same idea, the embodiment of the present application also provides an electronic device, such as Figure 6 As shown. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 601 and memory 602, and the memory 602 may store one or more storage applications or data. Among them, the memory 602 can be a temporary storage or a permanent storage. The application stored in the memory 602 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 601 can be configured to communicate with the memory 602 to execute a series of computer executable instructions in the memory 602 on the electronic device. The electronic device may also include one or more power supplies 603, one or more wired or wireless network interfaces 604, one or more input and output interfaces 605, and one or more keyboards 606.

[0126] Specifically in this embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs are configured to be executed by one or more processors, including the following computer executable instructions:

[0127] In response to a start instruction of a first application, reading routing protocol data of the first application from an executable file of the first application; the routing protocol data includes a component routing protocol of a service component of the first application;

[0128] generating a routing table for the first application according to the routing protocol data;

[0129] The running function in the executable file is loaded, and the first application is run according to the component routing protocol and the running function in the routing table.

[0130] The technical solution of the embodiment of the present application is adopted, by reading the routing protocol data of the first application from the executable file of the first application, generating the routing table of the first application according to the routing protocol data, and then loading the running function in the executable file, and running the first application according to the component routing protocol and running function in the routing table. It can be seen that since the executable file can read the routing protocol data in the executable file after the operating system enters the kernel layer, without waiting until entering the user layer (i.e., the application layer), the timing of reading the routing protocol data is advanced, ensuring that the routing table has been generated before the running function in the executable file of the first application is loaded, so that the registration timing of the routing table is before the running function of the first application is loaded, thereby avoiding the situation where the routing table has not been registered yet but the first application has been started, ensuring the smooth operation of the first application. In addition, since the routing protocol data includes the component routing protocols of the business components of the first application, after responding to the startup instruction of the first application, by triggering the action of reading the routing protocol data from the executable file, the component routing protocols of all business components can be read at one time, without the developer having to manually compile the corresponding routing protocol reading code for each business component. Therefore, when there are many business components in the first application, the labor cost in the registration process of the routing table can be greatly saved, the automatic registration effect of the routing table is achieved, and the startup efficiency of the first application is improved.

[0131] The embodiment of the present application further proposes a computer-readable storage medium, which stores one or more computer programs, and the one or more computer programs include instructions. When the instructions are executed by an electronic device including multiple application programs, the electronic device can execute each process of the above-mentioned application running method embodiment, and is specifically used to execute:

[0132] In response to a start instruction of a first application, reading routing protocol data of the first application from an executable file of the first application; the routing protocol data includes a component routing protocol of a service component of the first application;

[0133] generating a routing table for the first application according to the routing protocol data;

[0134] The running function in the executable file is loaded, and the first application is run according to the component routing protocol and the running function in the routing table.

[0135] The technical solution of the embodiment of the present application is adopted, by reading the routing protocol data of the first application from the executable file of the first application, generating the routing table of the first application according to the routing protocol data, and then loading the running function in the executable file, and running the first application according to the component routing protocol and running function in the routing table. It can be seen that since the executable file can read the routing protocol data in the executable file after the operating system enters the kernel layer, without waiting until entering the user layer (i.e., the application layer), the timing of reading the routing protocol data is advanced, ensuring that the routing table has been generated before the running function in the executable file of the first application is loaded, so that the registration timing of the routing table is before the running function of the first application is loaded, thereby avoiding the situation where the routing table has not been registered yet but the first application has been started, ensuring the smooth operation of the first application. In addition, since the routing protocol data includes the component routing protocols of the business components of the first application, after responding to the startup instruction of the first application, by triggering the action of reading the routing protocol data from the executable file, the component routing protocols of all business components can be read at one time, without the developer having to manually compile the corresponding routing protocol reading code for each business component. Therefore, when there are many business components in the first application, the labor cost in the registration process of the routing table can be greatly saved, the automatic registration effect of the routing table is achieved, and the startup efficiency of the first application is improved.

[0136] An embodiment of the present application provides a computer program product, including a computer program, which is executed by a processor to implement the various processes of the above-mentioned application running method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0137] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0138] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0139] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0140] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0141] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0142] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0143] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0144] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0145] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0146] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0147] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0148] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0149] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. An application running method, characterized in that: include: In response to a start instruction of a first application, reading routing protocol data of the first application from an executable file of the first application; The routing protocol data includes a component routing protocol of a service component of the first application; generating a routing table for the first application according to the routing protocol data; The running function in the executable file is loaded, and the first application is run according to the component routing protocol and the running function in the routing table.

2. The method according to claim 1, characterized in that The reading the routing protocol data of the first application from the executable file of the first application includes: Calling an initialization function of the first application; a function pointer of the initialization function points to the routing protocol data; Based on the initialization function, the routing protocol data is read from the executable file.

3. The method according to claim 2, characterized in that The reading the routing protocol data from the executable file based on the initialization function includes: Execute the dynamic loading callback function pre-registered in the initialization function; Based on the dynamic loading callback function, traverse the executable file until a specified memory area in the executable file is found; the specified memory area is used to store the routing protocol data; The routing protocol data is read from the designated memory area.

4. The method according to claim 1, characterized in that: The routing protocol data also includes a mapping relationship between the component routing protocol and the implementation class of the service component; and generating a routing table of the first application according to the routing protocol data includes: Determine the implementation class of the component routing protocol of each business component based on the mapping relationship between the component routing protocol and the implementation class of the business component; Based on the implementation class, determining an instantiation implementation method of the component routing protocol of each business component; Based on the instantiation implementation method, the component routing protocol of each business component is instantiated to obtain the routing table.

5. The method according to claim 2, characterized in that: Before reading the routing protocol data of the first application from the executable file of the first application in response to the startup instruction of the first application, the method further includes: By means of macro definition, the designated fields included in the routing protocol data are defined, and a mapping relationship between the designated fields is created; the designated fields include the component routing protocol and implementation class of the service component; The designated field and the mapping relationship are written into the executable file.

6. The method according to claim 2, characterized in that Before reading the routing protocol data of the first application from the executable file of the first application in response to the startup instruction of the first application, the method further includes: Obtaining a read function for reading the routing protocol data; Based on the attribute definition mechanism provided by the development tool of the first application, define the attributes of the read function to obtain the initialization function; The initialization function is encapsulated by macro definition.

7. The method according to claim 6, characterized in that The attribute definition mechanism provided by the development tool based on the first application is used to define the attribute of the read function in the executable file to obtain the initialization function, including: Obtaining a first identifier for characterizing a property of the initialization function; Based on the attribute definition mechanism, the first identifier is added to a specified position of the read function to obtain the initialization function.

8. An application running device, characterized in that: include: a reading module, configured to read the routing protocol data of the first application from an executable file of the first application in response to a startup instruction of the first application; The routing protocol data includes a component routing protocol of a service component of the first application; A generating module, configured to generate a routing table for the first application according to the routing protocol data; A running module is used to load the running function in the executable file and run the first application according to the component routing protocol and the running function in the routing table.

9. An electronic device, characterized in that: It comprises a processor and a memory electrically connected to the processor, the memory stores a computer program, and the processor is used to call and execute the computer program from the memory to implement the application running method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The storage medium is used to store a computer program, and the computer program can be executed by a processor to implement the application running method according to any one of claims 1 to 7.

11. A computer program product, characterized in that The invention comprises a computer program, wherein the computer program is executed by a processor to implement the application running method according to any one of claims 1 to 7.