Plug-in version storage method and device, plug-in version reading method and device, equipment and storage medium

By using auxiliary macros to save the plug-in version number in the executable part of the plug-in, the problem of plug-in version management under different platforms and compilers is solved, and the correctness of plug-in versions and application stability is achieved across platforms.

CN119987833APending Publication Date: 2025-05-13CHINA NAT PETROLEUM CORP +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311498389.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-10
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

Under different platforms and compilers, it is difficult for the existing technology to effectively manage plug-in versions, resulting in the application loading of incompatible plug-ins, affecting stability and security.

Method used

By calling the auxiliary macro, add the plug-in version number to the executable part of the plug-in to ensure that the plug-in version information can be correctly obtained and saved under different platforms and compilers.

Benefits of technology

It implements a common plug-in version storage and reading method under different platforms and compilers to ensure that the application can load the correct version of the plug-in and improves system stability and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987833A_ABST
    Figure CN119987833A_ABST
Patent Text Reader

Abstract

The invention discloses a plug-in version storage method and device, a plug-in version reading method and device, equipment and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: setting a target version number of a plug-in configuration file; based on the auxiliary macro, adding a plug-in version number for an executable part of the plug-in; obtaining a target version number and a plug-in version number; and comparing the plug-in version number with the target version number, if the plug-in version number is consistent with the target version number, loading the plug-in, and if not, displaying prompt information. Wherein the plug-in version number is added for the executable part by using the defined auxiliary macro, any compiling option does not need to be added during compiling, and the method is also feasible under different platforms and different compilers. Reading the plug-in version number from the executable part is started from the tail of the executable part, and the plug-in version number in the executable part can be obtained more quickly. The plug-in is loaded after the version number of the plug-in is compared with the target version number, so that the plug-in loaded to the correct version can be ensured, and system crash possibly caused by direct loading of the plug-in is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a plug-in version storage method and reading method, device, equipment and storage medium. Background Art

[0002] With the development of Internet technology, the functions of applications are becoming more and more abundant, and the code volume is getting larger and larger, which makes it more and more difficult to update a certain application during the update. Therefore, plug-in development came into being. When it is necessary to add a certain function to an application, it is only necessary to develop a plug-in for the corresponding function and update the plug-in to the application. Subsequent maintenance and updates only need to be performed on the plug-in, which can greatly improve the development efficiency of the application and reduce maintenance costs. With the widespread application of plug-ins, plug-in management has gradually received attention. When the version loaded into the application is incompatible with the application, it may cause the application to crash at best, or even cause data loss and financial losses at worst.

[0003] Different platforms and compilers have their own applicable methods for plug-in management, especially plug-in version management. For example, the version information can be saved in the plug-in by using the version function provided by the system or the compilation option provided by the compiler. However, when this method is used, due to the different systems or compilers used, it cannot be guaranteed that the application can correctly obtain the plug-in version information under different platforms and different compilers. It may cause the loading of plug-ins that are incompatible with the application, making it difficult to ensure the stability of the application.

[0004] Therefore, how to design a universal plug-in version access method under different platforms and different compilers so that the application can load the correct version of the plug-in is a problem that needs to be solved at present. Summary of the invention

[0005] The present application provides a plug-in version storage method and reading method, device, equipment and storage medium, and the technical solution is as follows:

[0006] According to one aspect of the present application, a plug-in version storage method is provided, the method comprising:

[0007] Get the plugin version number;

[0008] Based on the auxiliary macro, the plug-in version number is added to the executable part of the plug-in, the executable part of the plug-in is the executable code for implementing the plug-in function, and the auxiliary macro is a macro for assisting in saving the plug-in version number.

[0009] According to one aspect of the present application, a method for reading a plug-in version is provided, the method comprising:

[0010] Obtaining a plug-in to be verified, wherein the plug-in to be verified includes an executable part, and the executable part includes a plug-in version number of the plug-in to be verified;

[0011] The detection starts from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

[0012] According to one aspect of the present application, a method for reading a plug-in version is provided, wherein the executable portion of the plug-in to be verified includes the plug-in version information of the plug-in to be verified, and the plug-in version information includes the plug-in version number and the plug-in version keyword;

[0013] The detecting starts from the end of the executable part and obtains the plug-in version number of the plug-in to be verified, including:

[0014] The plug-in version keyword is detected from the end of the executable part to obtain the plug-in version information of the plug-in to be verified.

[0015] According to one aspect of the present application, a method for reading a plug-in version is provided, wherein the plug-in to be verified further includes a non-executable part, and the non-executable part of the plug-in to be verified includes a plug-in configuration file, and the method further includes:

[0016] Obtain the plug-in configuration file, wherein the plug-in configuration file includes the target version number of the plug-in to be verified;

[0017] Based on the plug-in version number and the target version number, the plug-in to be verified is loaded.

[0018] According to one aspect of the present application, a method for reading a plug-in version is provided, wherein the method loads the plug-in to be verified based on the plug-in version number and the target version number, comprising:

[0019] When the plug-in version number is the same as the target version number, the plug-in to be verified is loaded.

[0020] According to one aspect of the present application, a plug-in version storage device is provided, the device comprising:

[0021] The first acquisition module is used to obtain the plug-in version number;

[0022] The version increasing module is used to increase the plug-in version number for the executable part of the plug-in based on the auxiliary macro. The executable part of the plug-in is the executable code used to implement the plug-in function, and the auxiliary macro is a macro used to assist in saving the plug-in version number.

[0023] According to one aspect of the present application, a plug-in version reading device is provided, the device comprising:

[0024] A second acquisition module is used to acquire a plug-in to be verified, wherein the plug-in to be verified includes an executable part, and the executable part includes a plug-in version number of the plug-in to be verified;

[0025] The third acquisition module is used to start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

[0026] According to one aspect of the present application, a computer device is provided, comprising: a processor and a memory, wherein the memory stores at least one program; the processor is configured to execute the at least one program in the memory to implement the above-mentioned plug-in version storage method, or the plug-in version reading method.

[0027] According to one aspect of the present application, a computer-readable storage medium is provided, in which executable instructions are stored. The executable instructions are loaded and executed by a processor to implement the above-mentioned plug-in version storage method, or plug-in version reading method.

[0028] According to one aspect of the present application, a computer program product is provided, which includes computer instructions stored in a computer-readable storage medium, and a processor reads and executes the computer instructions from the computer-readable storage medium to implement the above-mentioned plug-in version storage method, or plug-in version reading method.

[0029] The beneficial effects of the technical solution provided by this application include at least:

[0030] The above solution adds the plug-in version number to the executable part of the plug-in by calling the auxiliary macro. Since macro is a language feature of C / C++, even if different platforms and different compilers are used, as long as the plug-in is based on the C / C++ language, the plug-in version storage method is supported, and a plug-in version storage method that is common to different platforms and different compilers can be implemented. In addition, using this method to save the plug-in version number does not require any compilation options to be added during compilation, making it easier to save the plug-in version number. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0032] Figure 1 An architectural diagram of a computer system provided by an exemplary embodiment of the present application is shown;

[0033] Figure 2 A flowchart of a plug-in version storage method provided by an exemplary embodiment of the present application is shown;

[0034] Figure 3 A flowchart of a plug-in version storage method provided by an exemplary embodiment of the present application is shown;

[0035] Figure 4 A flowchart of a plug-in version storage method provided by an exemplary embodiment of the present application is shown;

[0036] Figure 5 A flowchart of a plug-in version reading method provided by an exemplary embodiment of the present application is shown;

[0037] Figure 6 A flowchart of a plug-in version reading method provided by an exemplary embodiment of the present application is shown;

[0038] Figure 7 A flowchart of a plug-in version reading method provided by an exemplary embodiment of the present application is shown;

[0039] Figure 8 A flowchart of a plug-in version reading method provided by an exemplary embodiment of the present application is shown;

[0040] Fig. 9 A flowchart of a plug-in version reading method provided by an exemplary embodiment of the present application is shown;

[0041] Fig.10 A flowchart of a plug-in loading method provided by an exemplary embodiment of the present application is shown;

[0042] Fig.11 A structural block diagram of a plug-in version storage device provided by an exemplary embodiment of the present application is shown;

[0043] Fig.12 A structural block diagram of a plug-in version reading device provided by an exemplary embodiment of the present application is shown;

[0044] Fig.13 A schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION

[0045] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0046] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0047] The terms used in this disclosure are for the purpose of describing specific embodiments only and are not intended to limit the disclosure. The singular forms of "a", "said" and "the" used in this disclosure and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0048] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the information such as setting operations involved in this application is obtained with full authorization.

[0049] It should be understood that although the terms first, second, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0050] First, the relevant terms involved in this application are introduced:

[0051] Plug-in: A file used to add functionality to an application. It is a program written in accordance with the application program interface. A plug-in must rely on an application to function as a plug-in, but an application can run even without a plug-in. That is, a plug-in can be loaded into an application to dynamically update the application without changing the application itself. Due to this feature of plug-ins, when program developers need to add functionality to an application, they can develop a plug-in for the application to implement this functionality, and then load the plug-in into the application to update the application. Because plug-ins can be used in application updates, plug-in development has developed rapidly. Since an application may have multiple plug-ins, a corresponding plug-in management system will be set up to manage the plug-ins of the application.

[0052] Macro: A language feature of a programming language. For example, C or C++ have macros. Macros can be used to replace symbols or statements in the code. When there are a lot of similar and repeated codes in the code, using macros can greatly reduce the amount of code, making it easier to write and view. At the same time, macros are a basic language feature. As long as the language supports macros, the same results will be obtained after using macros on different platforms and different compilers.

[0053] Figure 1 The structure block diagram of a computer system 100 provided by an exemplary embodiment of the present application is shown. The computer system 100 includes: a terminal 110 .

[0054] The terminal 110 may be an electronic device such as a mobile phone, a tablet computer, a vehicle-mounted terminal (vehicle computer), a wearable device, a PC (Personal Computer), an unmanned reservation terminal, etc. The terminal 110 may be installed with a client for running the target application, and the target application may be an application developed based on a plug-in; or, an application that supports the installation of plug-ins, such as development software Visual Studio Code, Eclipse, etc. that supports plug-ins, browsers Google (Google), Firefox, etc. that support plug-ins, tool software that supports the installation of plug-ins, etc.; or, a development framework that supports plug-in development, such as OSGi (Open Service Gateway Initiative, Open Service Gateway Protocol), DroidPlugin, x3py, gazebo, etc. The embodiment of the present application does not limit the form of the target application, including but not limited to the client, application, applet, etc. installed in the terminal 110, and may also be in the form of a web page. The terminal 110 may also be the background server of the above-mentioned application.

[0055] In some embodiments, terminal 110 is used to implement a plug-in version storage method to store the plug-in version number in the executable part of the plug-in; or, terminal 110 is used to save the plug-in version number as plug-in version information and store it with the executable part of the plug-in.

[0056] In some embodiments, terminal 110 is also used to implement a plug-in version reading method to read the plug-in version number from the executable part of the plug-in; or, terminal 110 is used to read the plug-in version information from the executable part of the plug-in; or, terminal 110 is used to obtain the target version number in the plug-in configuration file; or, terminal 110 is used to load the plug-in based on the plug-in version number and the target version number.

[0057] Optionally, the computer system 100 further includes a server 120. The server 120 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and cloud servers for basic cloud computing services such as big data and artificial intelligence platforms. The server 120 is used to provide background services for the applications in the above-mentioned terminal 110.

[0058] The terminal 110 and the server 120 may communicate with each other via a network, such as a wired or wireless network.

[0059] Those skilled in the art will appreciate that the number of the above-mentioned terminals 110 may be more or less. For example, the above-mentioned terminal 110 may be only one, or may be dozens or hundreds, or more. The embodiment of the present application does not limit the number and device type of the terminals 110.

[0060] Figure 2 A plug-in version storage method provided by an exemplary embodiment of the present application is shown, and the method is executed by a computer device, which may be Figure 1 The terminal or server shown. The method comprises:

[0061] Step 210: Obtain the plug-in version number of the plug-in;

[0062] In some embodiments, the plug-in version number is used to identify the plug-in version.

[0063] In some embodiments, the plug-in version number includes a major version number and a minor version number. Optionally, the plug-in version number also includes at least one of a revision version number and a compilation version number.

[0064] In some embodiments, the format of the plugin version number is at least one of the following:

[0065] major version number.minor version number[.fix version number[.build version number]]; or,

[0066] major version number.minor version number[.build version number[.fix version number]]; or,

[0067] Major version number.Sub-version number[.Correction version number[build-compilation version number]].

[0068] Among them, the major version number is used to identify a large rewrite of the plugin content; the minor version number is used to identify a significant update of the plugin content; the revision version number is used to identify a partial update of the plugin content or a bug fix; the compilation version number is used to identify the compiler information used to compile the plugin. [] indicates optional.

[0069] Exemplarily, the plug-in version number is 1.0; or, the plug-in version number is 1.0.0; or, the plug-in version number is 1.0.0.0.

[0070] Step 220: Based on the auxiliary macro, add the plug-in version number to the executable part of the plug-in, the executable part of the plug-in is the executable code used to implement the plug-in function, and the auxiliary macro is a macro used to assist in saving the plug-in version number.

[0071] In some embodiments, the executable portion of the plug-in is an executable binary file, and the auxiliary macro can write the version number intactly into the executable binary file when the compiler compiles the plug-in.

[0072] In some embodiments, based on the auxiliary macro, the plug-in version number is added and saved for the executable part of the plug-in, the executable part of the plug-in is the executable code used to implement the plug-in function, and the auxiliary macro is a macro used to assist in saving the plug-in version number.

[0073] In some embodiments, the plug-in includes an executable part and a non-executable part, and the non-executable part includes a plug-in configuration file. Optionally, the non-executable part of the plug-in also includes a resource file.

[0074] In some embodiments, the auxiliary macro is called to increase the plug-in version number for the executable part of the plug-in. The auxiliary macro is a macro function, and the plug-in version number is a parameter of the macro function.

[0075] Exemplarily, the auxiliary macro is called to increase the plug-in version number for the executable part of the plug-in, which can be expressed as PLUGIN_VERSION (plug-in version number). The definition of the auxiliary macro is as follows.

[0076] #define PLUGIN_VERSION(ver)char pluginMetaData

[31] =ver;

[0077] Or, convert the plugin version number to a string before adding it to the plugin executable.

[0078] #define PLUGIN_VERSION(ver) char pluginMetaData

[31] = #ver; / / #The following parameter value will be converted into a string.

[0079] Wherein, ver represents the plug-in version number; this application uses an array length of 31 as an example, but does not limit this.

[0080] In some embodiments, the user directly calls the auxiliary macro in the executable part of the plug-in to add the plug-in version number to the executable part of the plug-in; or, the user inputs the plug-in version number into the plug-in version number saving interface, and the plug-in version number saving interface calls the auxiliary macro to add the plug-in version number to the executable part of the plug-in.

[0081] To summarize, the method provided in the embodiment of the present application adds the plug-in version number to the executable part of the plug-in by calling an auxiliary macro. Since the macro is a language feature of C / C++, even if different platforms and different compilers are used, as long as the plug-in is based on the C / C++ language, the plug-in version storage method is supported. It can implement a plug-in version storage method that is common to different platforms and different compilers, and use this method to save the plug-in version number. There is no need to add any compilation options during compilation, making the saving of the plug-in version number easier.

[0082] Based on Figure 2 In an optional embodiment, if Figure 3 As shown, step 220 can be implemented alternatively as step 221 and step 222.

[0083] Step 221: Based on the auxiliary macro, the plug-in version number and the plug-in version keyword are concatenated into the plug-in version information, and the plug-in version keyword is used to identify the plug-in version information;

[0084] In some embodiments, an auxiliary macro is called to concatenate the plug-in version number and the plug-in version keyword into the plug-in version information, wherein the plug-in version keyword is used to identify the plug-in version information.

[0085] Exemplarily, the plugin version keyword is PLUGINVER; or, the plugin version keyword is PLUGINVERSION; or, the plugin version keyword is PLUGIN_VERSION. It should be noted that the embodiment of the present application uses the plugin version keyword PLUGINVER as an example for illustration, and the role of the plugin version keyword is to identify the information as plugin version information. The specific settings of the plugin version keyword are not listed one by one in the embodiment of the present application, but the protection scope of the embodiment of the present application is not limited to this.

[0086] In some embodiments, the helper macro is defined as follows.

[0087] #define PLUGIN_VERSION(ver) char pluginMetaData

[31] = PLUGINVER:ver; / / PLUGINVER is the plug-in version keyword.

[0088] Or, convert the plugin version information into a string before adding it to the executable part of the plugin.

[0089] #define PLUGIN_VERSION(ver) char pluginMetaData

[31] = #PLUGINVER:ver; / / #The following parameter value will be converted into a string.

[0090] Among them, ver represents the plug-in version number, “:” is an exemplary connector, and the connector can also be a space “”, an underscore “_” or no connector “”, which is not limited in the embodiments of the present application.

[0091] Exemplarily, the plug-in version number is 1.0.0.1, and the plug-in version information is PLUGINVER:1.0.0.1; or, the plug-in version number is 1.0.0.1, and the plug-in version information is PLUGINVER1.0.0.1; or, the plug-in version number is 1.0.0.1, and the plug-in version information is PLUGINVER 1.0.0.1; or, the plug-in version number is 1.0.0.1, and the plug-in version information is PLUGINVER_1.0.0.1.

[0092] Step 222: Based on the auxiliary macro, add the plug-in version information to the executable part of the plug-in.

[0093] In some embodiments, the auxiliary macro is called to add the plug-in version information to the executable part of the plug-in. The definition of the auxiliary macro is as shown in the above step 221, and will not be repeated here.

[0094] In some embodiments, the user directly calls the auxiliary macro in the executable part of the plug-in to add the plug-in version number to the executable part of the plug-in; or, the user inputs the plug-in version number into the plug-in version number saving interface, and the plug-in version number saving interface calls the auxiliary macro to add the plug-in version number to the executable part of the plug-in.

[0095] In summary, the method provided in the embodiment of the present application adds a plug-in version keyword, and identifies the plug-in version information according to the plug-in version keyword, and the plug-in version information is composed of the plug-in version keyword and the plug-in version number. Adding a plug-in version keyword to the plug-in version number of the executable part of the plug-in facilitates the reading of the plug-in version, and can improve the reading efficiency and accuracy of the plug-in version.

[0096] Based on Figure 3 In an optional embodiment, if Figure 4 As shown, step 222 can be implemented alternatively as step 2221.

[0097] Step 2221: Based on the auxiliary macro, add the plug-in version information to the executable part of the plug-in in the form of static constants.

[0098] In some embodiments, the auxiliary macro is called to add the plug-in version information to the executable part of the plug-in in the form of a static constant. The definition of the auxiliary macro is as follows.

[0099] #define PLUGIN_VERSION(ver)static const unsigned char pluginMetaDat a

[31] =PLUGINVER:ver;

[0100] In some embodiments, the plug-in version information is first converted into a string form and then assigned to a static character array constant. The auxiliary macro definition using this method is as follows.

[0101] #define PLUGIN_VERSION_HELPER(f)#f / / Used to convert parameter f into a string.

[0102] #define PLUGIN_VERSION(ver)static const unsigned char pluginMetaDat a

[31] =PLUGIN_VERSION_HELPER(PLUGINVER:ver);

[0103] In some embodiments, the plug-in version information is added to the executable portion of the plug-in in the form of a static character array constant, which is an unsigned array.

[0104] In some embodiments, the auxiliary macro is called to add the plug-in version information to the executable part of the plug-in in the form of a static character array constant, where the character array is an unsigned array; or, the character array is a signed array.

[0105] In some embodiments, saving the plug-in version information as a static constant can prevent the compiler from optimizing it when loading. Optimization means that the compiler considers the information as invalid information and deletes it during compilation.

[0106] In some embodiments, the character char is a basic data type of the C / C++ language, and this data type is supported in different platforms and different compilers.

[0107] In some embodiments, since the representation of the character type (char) is composed of a signed type (signed char) and an unsigned type (unsigned char), in different platforms and compilers, if the representation of the character type is not specified and only the char keyword is used when using the character type, the actual representation of the character type may vary depending on the platform or compiler.

[0108] For example, in compiler a, char is actually a signed type (signed char); in compiler b, char is an unsigned type (unsigned char). Therefore, it is necessary to specify the character array as a signed type or an unsigned type in the auxiliary macro to prevent the character type from being expressed differently on different platforms or different compilers. In the embodiments of the present application, the character type is specified as an unsigned type for illustration, but this is not limited to this.

[0109] In some embodiments, the length of the character array can be customized. For example, the length of the pluginMetaData

[31] character array is 31; or, the length of the pluginMetaData

[21] character array is 21; or, the length of the pluginMetaData

[15] character array is 15.

[0110] In summary, the method provided in the embodiment of the present application saves the plug-in version information in the form of a static character array constant to the executable part of the plug-in. Using this method, on the one hand, it can prevent the compiler from considering the information as invalid information and optimizing it, thereby causing the loss of version information during compilation. On the other hand, by using a character array that specifies the representation of characters, this format is supported on different platforms and different compilers, and has good versatility.

[0111] Figure 5 A plug-in version reading method provided by an exemplary embodiment of the present application is shown, and the method is executed by a computer device, which may be Figure 1 The terminal or server shown. The method comprises:

[0112] Step 310: Obtain the plug-in to be verified, where the plug-in to be verified includes an executable part, and the executable part includes the plug-in version number of the plug-in to be verified;

[0113] In some embodiments, the plug-in to be verified includes an executable part, which is an executable code for implementing the plug-in function.

[0114] In some embodiments, the executable part includes a plug-in version number of the plug-in to be verified, and the plug-in version number is saved to the executable part of the plug-in to be verified by the above-mentioned plug-in version storage method.

[0115] In some embodiments, the executable portion of the plug-in to be verified is a binary file compiled from the executable code of the plug-in to be verified; or, the executable portion of the plug-in to be verified is a binary file of the plug-in to be verified.

[0116] In some embodiments, the executable portion of the plug-in to be verified is an executable file or a dynamic link library.

[0117] Step 320: Start detection from the end of the executable part and obtain the plug-in version number of the plug-in to be verified.

[0118] In some embodiments, detection is preferentially started from the end of the executable portion to obtain the plug-in version number of the plug-in to be verified.

[0119] In some embodiments, the plugin version number is stored at the end of the executable.

[0120] To sum up, the method provided in the embodiment of the present application shows a plug-in version reading method, which preferentially detects the version number of the plug-in to be verified from the end of the executable part. Since the plug-in version number saved using the above-mentioned plug-in version storage method will be stored at the end of the executable part during compilation, starting detection from the end can read the plug-in version number more quickly.

[0121] Based on Figure 5 In an optional embodiment, if Figure 6 As shown, step 320 can be implemented alternatively as step 321 - 1 or step 321 - 2.

[0122] In some embodiments, step 321 - 1 is executed first, and if step 321 - 1 fails, step 321 - 2 is executed.

[0123] Step 321-1: Using file mapping, start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified;

[0124] In some embodiments, a memory mapping method is used to start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

[0125] In some embodiments, file mapping is also called memory mapping, which maps a file to the address space of a process that detects the executable portion. File mapping can be understood as mapping a file stored in a hard disk to memory, so that the process can read and write files like reading memory, and the speed of reading memory is often much faster than the speed of reading a hard disk.

[0126] Step 321 - 2: Using a binary data stream, start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

[0127] In some embodiments, an Input / Output Stream (I / O Stream) method is adopted to start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

[0128] In some embodiments, a binary data stream is used to detect from the end of the executable part to obtain the plug-in version number of the plug-in to be checked. The binary data stream is an input and output stream that is read and written in binary form. Files can be divided into binary files and text files according to the data format, so the input and output streams include binary data streams and text data streams. For the same file, the reading and writing speed of the binary data stream is faster than the reading and writing speed of the text file.

[0129] Streams represent the way data is transmitted and processed. Streams can be seen as channels for data. File streams are one of the important ways to read and write files. Input and output streams are used to identify the direction of data. For example, reading from a file to a program is an input stream, and writing data from a program to a file is an output stream. When reading a file, the embodiment of the present application actually only uses the input stream.

[0130] In some embodiments, the input stream is used to start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

[0131] In summary, the method provided in the embodiment of the present application shows two methods for reading the plug-in version number from the executable part. By using one of the above two methods, the plug-in version number is read from the end of the executable part, and the plug-in version number of the plug-in to be detected can be detected at the fastest speed. In addition, the above two methods are both supported by different platforms and different compilers, which can ensure the universality of the plug-in version reading method.

[0132] Based on Figure 5 In an optional embodiment, if Figure 7 As shown, step 320 can be implemented alternatively as step 322 .

[0133] In some embodiments, the executable portion of the plug-in to be verified includes plug-in version information of the plug-in to be verified, and the plug-in version information includes a plug-in version number and a plug-in version keyword.

[0134] Step 322: Detect the plug-in version keyword from the end of the executable part to obtain the plug-in version information of the plug-in to be verified.

[0135] In some embodiments, the plug-in version information of the plug-in to be verified is obtained from the executable part by detecting the plug-in version keyword at the end of the executable part.

[0136] In some embodiments, a file mapping method is adopted to detect the plug-in version keyword from the end of the executable part to obtain the plug-in version information of the plug-in to be verified.

[0137] In some embodiments, the plug-in version keyword is detected from the end of the executable part in an input-output stream manner to obtain the plug-in version information of the plug-in to be verified.

[0138] Exemplarily, the plugin version keyword is detected from the end of the executable part. After the plugin version keyword is found, n characters are read from the head of the plugin version keyword, where n is a positive integer. The plugin version number is read from the n characters read according to the plugin version number format. Optionally, n is the length of the plugin version information, such as the length of the character array of the above-mentioned plugin version storage method; or, n is a preset value, such as a preset reading length of 50 characters, or a preset reading length of 50 bytes.

[0139] In some embodiments, the plug-in version keyword is detected starting from the end of the executable portion to obtain the plug-in version number of the plug-in to be verified.

[0140] In some embodiments, the plug-in version keyword is detected from the end of the executable part. When the plug-in version keyword is found, the plug-in version number is read from after the plug-in version keyword, and the plug-in version information of the plug-in to be verified is read according to the plug-in version number format.

[0141] Exemplarily, the plug-in version number format is major version number.minor version number.revision version number.compile version number. The plug-in version number is read from the plug-in version keyword according to the plug-in version number format to obtain the plug-in version number 1.0.0.0.

[0142] In summary, the method provided in the embodiment of the present application shows a method for reading the plug-in version number according to the plug-in version keyword. By reading the plug-in version information through the plug-in version keyword, the plug-in version information can be read more quickly and accurately.

[0143] Based on Figure 5 In an optional embodiment, if Figure 8 As shown, the method further includes step 330 and step 340.

[0144] In some embodiments, the plugin to be verified further includes a non-executable part, and the non-executable part of the plugin to be verified includes a plugin configuration file. The plugin configuration file is used to indicate at least one of the functions provided by the plugin, the interfaces provided by the plugin, and the resources provided by the plugin.

[0145] In some embodiments, the non-executable part of the plugin to be verified further includes a resource file. Exemplarily, the resource file is at least one of a picture file, a video file, a UI (User Interface) file, and an audio file.

[0146] In some embodiments, the plugin to be verified includes at least a plugin configuration file.

[0147] Step 330: Obtain the plugin configuration file, where the plugin configuration file includes the target version number of the plugin to be verified;

[0148] In some embodiments, the user sets the target version number of the plugin to be verified for the plugin configuration file.

[0149] In some embodiments, the plugin configuration file includes the target version number of the plugin to be verified, and the target version number is the attribute version of the plugin element <plugin>< / plugin> in the plugin configuration file. The plugin element can also be called a plugin tag, as shown below.

[0150] <!--Configuration file declaration, version is the version number of the configuration file-->

[0151] <?xml version="1.0"?>

[0152] <!--The plugin element includes the module name ModuleName and the version-->

[0153] <Plugin ModuleName="mainframe" version="target version number">Plugin configuration information

[0154]

[0155] In some embodiments, the plugin configuration information is used to indicate at least one of the functions provided by the plugin, the interfaces provided by the plugin, and the resources provided by the plugin. The plugin configuration information is configured in the plugin configuration file through an extension point element <extension-point>< / extension-point> and an extension point sub-element <extension>< / extension> A plugin configuration file with an extension point element and an extension point sub-element is as shown below.

[0156] <?xml version="1.0"?>

[0157] <Plugin ModuleName="mainframe"version="1.0.0.0">

[0158] <! — The attributes of the extension point element include at least one of the unique identifier id, index property name index-property-name, file file, and interface inertface -->

[0159] <extension-point id=""index-property-name=""file=""inertface="">

[0160] <! — The attributes of the extension point element include the corresponding extension point extension-point, the unique identifier id, the class class, and whether it is at least one of the singleton attributes -->

[0161] <extension extension-point=""id=""class=""singleton="">

[0162] <extension-point id=""index-property-name=""file=""inertface="">

[0163] <extension extension-point=""id=""class=""singleton=""> ...

[0165]

[0166] It should be noted that the file content of the above-mentioned plug-in configuration file only shows the plug-in configuration file in xml (ExtensibleMarkup Language) format, but in the specific implementation process, the file format of the plug-in configuration file can also be json (JavaScript Object Notation) format, txt format, ini (initialization) format, properties format, yaml format, toml format, etc.

[0167] Step 340: Based on the plug-in version number and the target version number, load the plug-in to be verified.

[0168] In some embodiments, Fig. 9 As shown, step 340 can be implemented alternatively as step 341 .

[0169] Step 341: When the plug-in version number is the same as the target version number, load the plug-in to be verified.

[0170] In some embodiments, when it is determined that the plug-in version number is the same as the target version number, the plug-in to be verified is loaded; when it is determined that the plug-in version number is not the same as the target version number, the plug-in to be verified is not loaded.

[0171] In some embodiments, the terminal does not obtain the target version number and loads the plug-in to be verified.

[0172] In some embodiments, the terminal device does not obtain the plug-in version number, but obtains the target version number, and does not load the plug-in to be verified.

[0173] In some embodiments, when the plug-in to be verified is not loaded, a prompt message indicating a plug-in version error is displayed.

[0174] To sum up, the method provided in the embodiment of the present application shows that after reading the plug-in version number, the target version number in the configuration file is read, and then based on the plug-in version number and the target version number, it is determined whether to load the plug-in to be verified. Using this method can ensure that the application loads the correct version of the plug-in, and makes good use of the plug-in version storage method and plug-in version reading method provided in the embodiment of the present application.

[0175] Fig.10 A flowchart of a plug-in loading method provided by an exemplary embodiment of the present application is shown. The method uses the plug-in version storage method and the plug-in version reading method provided by the embodiment of the present application. The method is executed by a computer device, which may be Figure 1 The terminal or server shown. The method comprises:

[0176] Step 410: Start the application;

[0177] In some embodiments, an application in a terminal is started, the application being an application developed based on a plug-in; or an application supporting installation of a plug-in; or a tool software supporting installation of a plug-in.

[0178] Step 420: Start the plug-in kernel;

[0179] In some embodiments, the plug-in kernel is a kernel of a plug-in management system for managing application programs. In an embodiment of the present application, the plug-in kernel is used to determine whether to load a plug-in for an application program.

[0180] Step 430: Read the application configuration file list;

[0181] In some embodiments, the application includes an application configuration file list for indicating at least one of a plug-in of the application, a plug-in storage location, a plug-in usage, and a plug-in type.

[0182] In some embodiments, the application profile list includes at least one plug-in.

[0183] Step 440: Read the plugin configuration file of the i-th plugin;

[0184] Wherein, i is a positive integer.

[0185] In some embodiments, based on the application configuration file list, the i-th plug-in is obtained from the application configuration file list, and the plug-in kernel reads the plug-in configuration file of the i-th plug-in based on the storage location of the i-th plug-in.

[0186] Step 450: Check whether the plug-in configuration file is set with a target version number;

[0187] In some embodiments, it is detected whether a target version number is set in the plug-in configuration file of the i-th plug-in. If the target version number is not set, step 460 is executed; if the target version number is set, step 470 is executed.

[0188] Step 460: Load the i-th plug-in;

[0189] In some embodiments, the plug-in kernel loads the i-th plug-in for the application.

[0190] Step 470: Check whether the plug-in version number of the executable part of the plug-in is correct;

[0191] In some embodiments, the plug-in version reading method is used to read the plug-in version number of the executable part, and the plug-in version number is saved in the executable part of the plug-in using the plug-in version storage method.

[0192] In some embodiments, it is determined whether the plug-in version number is consistent with the target version number. If they are consistent, it means that the plug-in version number is correct, and step 460 is executed. If they are inconsistent, it means that the plug-in version number is incorrect, and i=i+1 is set, and step 430 is executed.

[0193] Step 480: Whether the i-th plug-in is the last plug-in.

[0194] In some embodiments, it is determined whether the i-th plug-in is the last plug-in in the application configuration file. If so, it means that the application configuration file list has been read, all correct plug-ins are loaded into the system, and the process ends; if it is not the last plug-in, i=i+1 is set and step 430 is executed.

[0195] To sum up, the method provided in the embodiment of the present application utilizes the plug-in version storage method and plug-in version reading method provided in the embodiment of the present application, realizes plug-in version management in the application, enables the application to load the correct version of the plug-in, thereby preventing application anomalies caused by loading incompatible versions of plug-ins.

[0196] Please refer to Fig.11 , which shows a block diagram of a plug-in version storage device provided by an embodiment of the present application. The device has the function of implementing the above plug-in version storage method example, and the function can be implemented by hardware or by hardware executing corresponding software. The device can be the terminal described above, or it can be set in the terminal. Fig.11 As shown, the device 500 may include: a first acquisition module 510 and a version adding module 520.

[0197] A first acquisition module 510 is used to acquire a plug-in version number of a plug-in;

[0198] The version adding module 520 is used to add the plug-in version number to the executable part of the plug-in based on the auxiliary macro. The executable part of the plug-in is the executable code used to implement the plug-in function, and the auxiliary macro is a macro used to assist in saving the plug-in version number.

[0199] In some embodiments, the version adding module 520 includes a splicing submodule and an adding submodule.

[0200] A splicing submodule, used for splicing the plug-in version number and the plug-in version keyword into plug-in version information based on the auxiliary macro, wherein the plug-in version keyword is used to identify the plug-in version information;

[0201] A submodule is added, for adding the plug-in version information to the executable part of the plug-in based on the auxiliary macro.

[0202] In some embodiments, adding a submodule includes adding a unit.

[0203] An adding unit is used to add the plug-in version information to the executable part of the plug-in in a static constant form based on the auxiliary macro.

[0204] Please refer to Fig.12 , which shows a block diagram of a plug-in version storage device provided by an embodiment of the present application. The device has the function of implementing the above plug-in version storage method example, and the function can be implemented by hardware or by hardware executing corresponding software. The device can be the terminal described above, or it can be set in the terminal. Fig.12 As shown, the device 600 may include: a second acquisition module 610 and a third acquisition module 620 .

[0205] A second acquisition module 610 is used to acquire a plug-in to be verified, wherein the plug-in to be verified includes an executable part, and the executable part includes a plug-in version number of the plug-in to be verified;

[0206] The third acquisition module 620 is used to start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

[0207] In some embodiments, the third acquisition module 620 includes a first acquisition submodule or a second acquisition submodule.

[0208] The first acquisition submodule is used to adopt a file mapping method to start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified;

[0209] The second acquisition submodule is used to adopt the input-output stream method to start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

[0210] In some embodiments, the third acquisition module 620 includes a third acquisition submodule.

[0211] The third acquisition submodule is used to detect the plug-in version keyword from the end of the executable part to obtain the plug-in version information of the plug-in to be verified.

[0212] In some embodiments, the apparatus 600 further includes a fourth acquisition module and a plug-in loading module.

[0213] A fourth acquisition module, configured to acquire the plug-in configuration file, wherein the plug-in configuration file includes a target version number of the plug-in to be verified;

[0214] The plug-in loading module is used to load the plug-in to be verified based on the plug-in version number and the target version number.

[0215] In some embodiments, the plug-in loading module includes a loading sub-module.

[0216] The loading submodule is used to load the plug-in to be verified when the plug-in version number is the same as the target version number.

[0217] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0218] Fig.13 The following is a block diagram of a computer device provided by an exemplary embodiment of the present application. The computer device can be used to implement the plug-in version storage method or plug-in version reading method provided in the above embodiments. Specifically:

[0219] The computer device 700 includes a central processing unit (CPU) 701, a system memory 704 including a random access memory (RAM) 702 and a read-only memory (ROM) 703, and a system bus 705 connecting the system memory 704 and the central processing unit 701. The computer device 700 also includes a basic input / output system (I / O system) 706 for facilitating information transmission between various components in the computer device, and a large-capacity storage device 707 for storing an operating system 713, application programs 714, and other program modules 715.

[0220] The basic input / output system 706 includes a display 708 for displaying information and an input device 709 such as a mouse and a keyboard for user inputting information. The display 708 and the input device 709 are connected to the central processing unit 701 through an input / output controller 710 connected to the system bus 705. The basic input / output system 706 may also include an input / output controller 710 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 710 also provides output to a display screen, a printer, or other types of output devices.

[0221] The mass storage device 707 is connected to the central processing unit 701 via a mass storage controller (not shown) connected to the system bus 705. The mass storage device 707 and its associated computer readable storage medium provide non-volatile storage for the computer device 700. That is, the mass storage device 707 may include a computer readable storage medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0222] Without loss of generality, the computer-readable storage medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable storage instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically Erasable Programmable Read-Only Memory (EEPROM), flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassette, tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 704 and mass storage device 707 can be collectively referred to as memory.

[0223] The memory stores one or more programs, and the one or more programs are configured to be executed by one or more central processing units 701. The one or more programs include instructions for implementing the above-mentioned method embodiments. The central processing unit 701 executes the one or more programs to implement the plug-in version storage method or the plug-in version reading method provided by the above-mentioned various method embodiments.

[0224] According to various embodiments of the present application, the computer device 700 can also be connected to a remote computer device on a network through a network such as the Internet. That is, the computer device 700 can be connected to a network 712 through a network interface unit 711 connected to the system bus 705, or the network interface unit 711 can be used to connect to other types of networks or remote computer device systems (not shown).

[0225] The memory also includes one or more programs, which are stored in the memory, and the one or more programs include steps executed by the terminal device in the plug-in version storage method or the plug-in version reading method provided in the embodiment of the present application.

[0226] In an exemplary embodiment, a non-transitory computer-readable storage medium is also provided, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the above-mentioned plug-in version storage method or plug-in version reading method.

[0227] In an exemplary embodiment, a computer program product is also provided. When the computer program product is executed by a processor, it is used to implement the above-mentioned plug-in version storage method or plug-in version reading method.

[0228] It should be understood that the "multiple" mentioned in this article refers to two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application are not limited to this.

[0229] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A plug-in version storage method, characterized in that: The method comprises: Get the plugin version number of the plugin; Based on the auxiliary macro, the plug-in version number is added to the executable part of the plug-in, the executable part of the plug-in is the executable code for implementing the plug-in function, and the auxiliary macro is a macro for assisting in saving the plug-in version number.

2. The method according to claim 1, characterized in that: The step of increasing the plug-in version number for the executable part of the plug-in based on the auxiliary macro includes: Based on the auxiliary macro, the plug-in version number and the plug-in version keyword are concatenated into plug-in version information, where the plug-in version keyword is used to identify the plug-in version information; Based on the auxiliary macro, the plug-in version information is added to the executable part of the plug-in.

3. The method according to claim 2, characterized in that The adding the plug-in version information to the executable part of the plug-in based on the auxiliary macro includes: Based on the auxiliary macro, the plug-in version information is added to the executable part of the plug-in in the form of a static constant.

4. A method for reading a plug-in version, characterized in that: The method comprises: Obtaining a plug-in to be verified, wherein the plug-in to be verified includes an executable part, and the executable part includes a plug-in version number of the plug-in to be verified; The detection starts from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

5. The method according to claim 4, characterized in that The detecting starts from the end of the executable part and obtains the plug-in version number of the plug-in to be verified, including: Using file mapping, starting detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified; or, The detection is started from the end of the executable part in a binary data stream manner to obtain the plug-in version number of the plug-in to be verified.

6. A plug-in version storage device, characterized in that: The device comprises: The first acquisition module is used to obtain the plug-in version number of the plug-in; The version increasing module is used to increase the plug-in version number for the executable part of the plug-in based on the auxiliary macro. The executable part of the plug-in is the executable code used to implement the plug-in function, and the auxiliary macro is a macro used to assist in saving the plug-in version number.

7. A plug-in version reading device, characterized in that: The device comprises: A second acquisition module is used to acquire a plug-in to be verified, wherein the plug-in to be verified includes an executable part, and the executable part includes a plug-in version number of the plug-in to be verified; The third acquisition module is used to start detection from the end of the executable part to obtain the plug-in version number of the plug-in to be verified.

8. A computer device, characterized in that: The computer device includes: a processor and a memory, wherein at least one program is stored in the memory; the processor is used to execute the at least one program in the memory to implement the plug-in version storage method described in any one of claims 1 to 3, or the plug-in version reading method described in any one of claims 4 to 5.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores executable instructions, and the executable instructions are loaded and executed by the processor to implement the plug-in version storage method described in any one of claims 1 to 3, or the plug-in version reading method described in any one of claims 4 to 5.

10. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. The processor reads and executes the computer instructions from the computer-readable storage medium to implement the plug-in version storage method described in any one of claims 1 to 3, or the plug-in version reading method described in any one of claims 4 to 5.