Function module loading method and device, and storage medium

CN117648138BActive Publication Date: 2026-10-23SUZHOU HUAXING YUANCHUANG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311645703.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-04
Publication Date
2026-10-23
Estimated Expiration
2043-12-04

AI Technical Summary

Technical Problem

然而,传统技术中加载模块的方式需要修改代码,过程较为繁琐,会降低软件系统开发更新的效率

Benefits of technology

[0034]上述各实施例中,当功能模块需要加载至软件系统中时,可以根据需要加载的功能模块,来确定出功能模块对应的配置文件和库文件,进而来确定功能模块对应的各种信息。另外,由于需要加载的功能模块中预先定义了动态库接口。因此响应于根据所述动态库接口确定所述库文件为目标库文件,可以确定当前的需要加载的功能模块为能够进行处理的功能模块,因此可以基于配置文件和目标库文件进行反序列化得到功能模块对应的功能模块对象,最终将功能模块对象加入模块列表清单中,模块列表清单中的模块对象用于供软件系统调用。软件系统可以调用模块列表清单中的模块对象来实现相应的功能。从而进而无需进行编译,也无需更改或者调整代码,只需进行反序列化即可。采用上述方法,在软件系统需要更新功能时无需进行编译和调整代码,能够提高软件系统更新开发的效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117648138B_ABST
    Figure CN117648138B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a function module loading method and device, and a storage medium. The method comprises: determining a configuration file and a library file corresponding to a function module to be loaded according to the function module, wherein a dynamic library interface is predefined in the function module to be loaded; in response to determining that the library file is a target library file according to the dynamic library interface, performing deserialization based on the configuration file and the target library file to obtain a function module object; and adding the function module object to a module list, wherein the module objects in the module list are used for calling by a software system. The method can complete loading without adjusting code when a new module needs to be loaded into the software system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, and storage medium for loading functional modules. Background Technology

[0002] With the development of computer technology, the need to expand functional modules is frequently encountered during software system development. After developing the external modules, they need to be loaded into the software system. Regardless of whether dynamic or static loading is used, the name and path of the dynamic library of the module to be loaded must be known in advance to correctly load the dynamic library of the new module into memory, thus enabling the software system to use the corresponding functions.

[0003] Traditionally, each time a new module is added, code to load the corresponding module's dynamic library must be included, and the software program must be recompiled and released. However, this traditional module loading method requires code modification, which is cumbersome and reduces the efficiency of software system development and updates. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, and storage medium for loading functional modules that can be completed without adjusting the code when a new module needs to be loaded into the software system, in order to address the above-mentioned technical problems.

[0005] Firstly, this disclosure provides a method for loading functional modules. The method includes:

[0006] Based on the functional modules to be loaded, determine the configuration files and library files corresponding to the functional modules, wherein the functional modules to be loaded have predefined dynamic library interfaces;

[0007] In response to determining the library file as the target library file based on the dynamic library interface, a functional module object is obtained by deserialization based on the configuration file and the target library file;

[0008] The functional module object is added to the module list, and the module objects in the module list are used for the software system to call.

[0009] In one embodiment, prior to determining that the library file is the target library file based on the dynamic library interface, the method further includes:

[0010] The library file is converted into a binary library file, and the binary library file is loaded as an instruction dictionary.

[0011] In one embodiment, the functional module to be loaded also predefines a module interface, which includes function calls to implement the functionality of the functional module; the step of deserializing the configuration file and the target library file to obtain the functional module object in response to determining the library file as the target library file based on the dynamic library interface includes:

[0012] In response to the detection of the existence of the dynamic library interface based on the instruction dictionary, the library file is determined to be the target library file;

[0013] The pre-created instance object is deserialized using the configuration file and target library file to obtain a functional module object, wherein the instance object is created based on the functional functions in the module interface.

[0014] In one embodiment, the dynamic library interface includes: an object return function, wherein the pre-created instance object is deserialized through the configuration file and the target library file to obtain a functional module object, including:

[0015] The pre-created instance object is deserialized using the configuration file and target library file, and the functional module object is output via the object return function.

[0016] In one embodiment, the method further includes:

[0017] In response to the existence of multiple configuration files for the functional modules that need to be loaded, wherein each of the multiple configuration files corresponds to a library file;

[0018] Select the target configuration file from the multiple configuration files, and deserialize the target configuration file and the target library file to obtain the functional module object.

[0019] In one embodiment, the dynamic library interface further includes a version information retrieval function, and the method further includes:

[0020] The version information acquisition function is used to obtain the version information of the functional module corresponding to the functional module object;

[0021] In response to the version information being different from the predetermined version information, the configuration file is redefined.

[0022] In one embodiment, determining the configuration file and library file corresponding to the functional module includes:

[0023] Obtain the file list directory of the software system;

[0024] Locate the files in each file list directory and add the file path of the configuration file in each file list directory to the configuration list;

[0025] The corresponding configuration file is determined based on the information of the functional modules and the configuration list;

[0026] The corresponding library files are determined from the file list directory based on the configuration file.

[0027] Secondly, this disclosure also provides a functional module loading device. The device includes:

[0028] The file determination module is used to determine the configuration file and library file corresponding to the functional module to be loaded, wherein the functional module to be loaded has a predefined dynamic library interface.

[0029] A deserialization module is used to deserialize the configuration file and the target library file to obtain a functional module object in response to determining that the library file is the target library file according to the dynamic library interface.

[0030] The function loading module is used to add the function module object to the module list list, and the module objects in the module list list are used for the software system to call.

[0031] Thirdly, this disclosure also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps in any of the above method embodiments.

[0032] Fourthly, this disclosure also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps in any of the above method embodiments.

[0033] Fifthly, this disclosure also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0034] In the above embodiments, when a functional module needs to be loaded into the software system, the configuration file and library file corresponding to the functional module can be determined based on the functional module to be loaded, thereby determining various information corresponding to the functional module. Furthermore, since the functional module to be loaded predefines a dynamic library interface, in response to determining the library file as the target library file based on the dynamic library interface, it can be determined that the currently loaded functional module is a functional module capable of being processed. Therefore, the functional module object corresponding to the functional module can be obtained by deserialization based on the configuration file and the target library file, and finally added to the module list. The module objects in the module list are used for calls by the software system. The software system can call the module objects in the module list to implement the corresponding functions. Thus, no compilation or code modification or adjustment is required; only deserialization is needed. Using the above method, when the software system needs to update its functions, no compilation or code adjustment is required, which can improve the efficiency of software system update development. Attached Figure Description

[0035] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0036] Figure 1 This is a schematic diagram of the application environment of the functional module loading method in one embodiment;

[0037] Figure 2 This is a flowchart illustrating a functional module loading method in one embodiment;

[0038] Figure 3 This is a schematic diagram illustrating the relationship between configuration files and library files in one embodiment;

[0039] Figure 4 This is a schematic diagram illustrating the relationship between the BlockBase base class and the interface in one embodiment;

[0040] Figure 5 This is a flowchart illustrating step S204 in one embodiment;

[0041] Figure 6 This is a flowchart illustrating the processing of multiple configuration files in one embodiment;

[0042] Figure 7 This is a flowchart illustrating the process of verifying version information in one embodiment;

[0043] Figure 8This is a flowchart illustrating the functional module loading method in another embodiment;

[0044] Figure 9 This is a structural block diagram of a functional module loading device in one embodiment;

[0045] Figure 10 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this disclosure.

[0047] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings herein are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0048] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0049] This disclosure provides a functional module method that can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with software system server 104 via a network. A data storage system can store data that the software system server 104 needs to process. The data storage system can be integrated onto the software system server 104 or placed on a cloud or other network server. Terminal 102 can first determine the functional modules of the software system that need to be loaded onto the software system server 104. Then, it can determine the configuration file and library file corresponding to the functional module in the data storage system. The functional module to be loaded has a predefined dynamic library interface. In response to terminal 102 determining the library file as the target library file based on the dynamic library interface, terminal 102 deserializes the configuration file to obtain the functional module object. Terminal 102 can add the functional module object to a module list. The module objects in the module list are used by the software system to implement the functions of the corresponding functional modules. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, etc. The software system server 104 can be implemented using a standalone server or a server cluster composed of multiple servers.

[0050] In one embodiment, such as Figure 2 As shown, a method for loading functional modules is provided, which can be applied to... Figure 1 Taking terminal 102 as an example, the explanation includes the following steps:

[0051] S202, determine the configuration file and library file corresponding to the functional module to be loaded, wherein the functional module to be loaded has a predefined dynamic library interface.

[0052] In this context, functional modules typically refer to modules corresponding to various functions within the software system, such as login and verification modules. The functional modules to be loaded can be existing modules in the software system or modules for functions that need to be added. Configuration files can be XML (Extensible Markup Language) files, which can store specific parameter values ​​for the default member variables of each functional module, such as the module name, its order in the module list, its type, and its enabled status flags. The data in the configuration file can be defined according to different functional modules. Library files can be DLL (Dynamic Link Library) files, allowing the DLL's exported functions to be determined at load time or runtime and loaded into the software system. Loading requires a file path (relative / absolute path). In some embodiments of this disclosure, the dynamic library interface can be an IBlockLibraryInterface dynamic library interface. In some embodiments of this disclosure, because functional modules need to be loaded, all functional modules in the software system typically predefine dynamic library interfaces during configuration or creation.

[0053] Specifically, when the software system first starts, it needs to load all functional modules. This means loading the functions corresponding to all modules into the software system for use. At this stage, all functional modules can be loaded. However, when a new function needs to be added after the software system has started, only the specific functional module corresponding to that added function needs to be loaded. Then, the configuration files and library files corresponding to the functional modules that need to be loaded are determined.

[0054] In some exemplary embodiments, such as Figure 3 As shown, typically, in some embodiments of this disclosure, one or more configuration files for each functional module in the software system can correspond to a library file. The library file can be loaded into the software system through the configuration file. Files with the .xml extension are configuration files, and files with the .dll extension are library files.

[0055] In addition, the configuration files and library files corresponding to the functional modules are determined, including:

[0056] Get the file list directory of the software system, find the files in each file list directory, and add the file path of the configuration file in each file list directory to the configuration list xmlFileList.

[0057] The corresponding configuration file is determined based on the information of the functional modules to be loaded and the configuration list xmlFileList.

[0058] Specifically, you can select the file path of the configuration file corresponding to the name of the functional module to be loaded from the configuration list xmlFileList, and determine the configuration file based on the file path.

[0059] For example, if the functional module is named Block1, and the file paths in the configuration list xmlFileList include: ...\Block1.xml, ...\Block2.xml, ...\Block3.xml, then ...\Block1.xml can be determined from the configuration list xmlFileList as the file path corresponding to the functional module Block1, and Block1.xml (the configuration file corresponding to functional module Block1) can be determined based on this file path. It should be noted that the ...\ in the above file paths represents the file path, and the data in ...\ will be different depending on the path. For example, in C:\Users\AA\Desktop\Block1.xml, then ...\ can be C:\Users\AA\Desktop\.

[0060] Then, the corresponding library file is determined from the file list directory based on the configuration file. Furthermore, the corresponding library file can be determined from the dynamic library directory within the file list directory by the name of the configuration file.

[0061] The file list directory is typically the directory corresponding to the software system, and it usually stores various files related to the software system, such as configuration files, library files, etc. The dynamic library directory is usually the directory corresponding to the software system's DLL libraries.

[0062] S204, in response to determining the library file as the target library file according to the dynamic library interface, a functional module object is obtained by deserialization based on the configuration file and the target library file.

[0063] Deserialization is the process of converting data stored in a serialized format back into an object in memory. In programming, object serialization refers to converting an object into a byte stream or other format that can be stored or transmitted so that the same object can be recreated later. Deserialization is required when an object needs to be recovered from stored or transmitted data. The deserialization process typically involves converting byte streams or other formatted data into instances of a class and reconstructing them back into the original object state. This process may involve reading data, decoding data, creating instances of the object, and setting data back into the object's properties. For example, when reading data from a database or file, it is often necessary to deserialize the stored data to obtain an operable object. Typically, different programming languages ​​and frameworks provide various deserialization tools and libraries to simplify this process, making it easier for developers to perform object serialization and deserialization operations. For example, there are serialization and deserialization mechanisms based on the C# language. The target library file can typically be a specification-compliant library file. Normally, if the dynamic library interface does not exist, it is another library file. After filtering, only library files that conform to the specifications are kept. Otherwise, errors will occur during the subsequent deserialization process, which may cause system crashes.

[0064] Specifically, the terminal can determine whether a library file is a target library file based on the dynamic library interface of the functional module. If a dynamic library interface exists, it can be determined that the functional module can be loaded into the software system. This confirms that the library file is a target library file. Then, the configuration file and the target library file can be deserialized to obtain the final functional module object.

[0065] S206, add the functional module object to the module list list. The module objects in the module list list are used for software system calls.

[0066] The module list can be a BlockList, which is a list that stores module objects for functional modules. These module objects can implement different functions. The module list can be located within the software system or in other storage units. In some embodiments of this disclosure, the specific location of the module list is not limited, as long as the software system can access the module objects within it.

[0067] Specifically, functional module objects can be added to the module list. When the software system needs to implement a certain function, it can call the corresponding module object from the module list to achieve the desired function.

[0068] In the above-described method for loading functional modules, when a functional module needs to be loaded into the software system, the configuration file and library file corresponding to the functional module can be determined based on the module to be loaded, thereby determining various information corresponding to the functional module. Furthermore, since the functional module to be loaded predefines a dynamic library interface, in response to determining the library file as the target library file based on the dynamic library interface, it can be determined that the currently loaded functional module is a processable functional module. Therefore, the functional module object corresponding to the functional module can be obtained by deserialization based on the configuration file and the target library file, and finally added to the module list. The module objects in the module list are used for calls by the software system. The software system can call the module objects in the module list to implement the corresponding functions. Thus, no compilation or code modification or adjustment is required; only deserialization is needed. Using this method, when the software system needs to update its functions, no compilation or code adjustment is required, which improves the efficiency of software system update development.

[0069] In one embodiment, in response to determining that the library file is the target library file based on the dynamic library interface, the method further includes:

[0070] The library file is converted into a binary library file, and the binary library file is loaded as an instruction dictionary.

[0071] The binary library file is typically binary data. The instruction dictionary may be an assembly dictionary in some embodiments of this disclosure.

[0072] Specifically, due to the different formats of library files, in order to facilitate the processing of library files and reduce software system crashes caused by library file errors, the library files can be converted into binary data to obtain binary library files. Then, the binary library files are loaded into an Assembly dictionary for subsequent processing.

[0073] In some exemplary embodiments, the library file can be loaded into memory as binary data using BinaryReader, thus obtaining the binary library file in memory. Then, Assembly.Load(byte[]) can be used to load the binary library file into an Assembly dictionary from the binary data. Subsequently, various functions within the Assembly dictionary can be used to filter and process the library file.

[0074] In this embodiment, since the library files are of different types and errors may occur during copying, the library files can be converted into binary library files and loaded as instruction dictionaries to facilitate the processing of the library files.

[0075] In one embodiment, the functional module to be loaded also predefines a module interface, which includes function calls. These function calls are used to implement the functionality of the functional module. Typically, the function calls can be customized according to the specific functions of different modules.

[0076] In some exemplary embodiments, the module interface may be an IBlockInterface module interface, whose functionalities may include Init() and Execute() functions, as well as other functionalities. Init() may be a function that performs initialization, and Execute() may specify the execution actions of the functional module. Module execution actions refer to the operations or functions performed by the module when it is invoked. These actions may include calculation, data processing, outputting results, calling other modules, etc. The execution actions of a module are defined by its code; when the module is introduced or imported, the corresponding actions can be performed by calling the functions or methods within the module.

[0077] In some exemplary embodiments, such as Figure 4 As shown, a base class `BlockBase` can be defined. Newly added functional modules will inherit from this base class, becoming subclasses of `BlockBase`, and will implement the dynamic library interface and the module interface. The module interface defines a specification that all new modules must adhere to, representing the functionality that modules must implement. The dynamic library interface defines the specifications that must be followed when used as a Library (as mentioned in some embodiments of this disclosure), requiring the implementation of the function to deserialize the XML configuration file and the target library file to return an instance of the module itself.

[0078] In some embodiments of this disclosure, it is mainly used to identify whether it is the required functional module through various functional functions in the module interface.

[0079] like Figure 5 As shown, the step of responding to determining the library file as the target library file based on the dynamic library interface, and obtaining a functional module object by deserialization based on the configuration file and the target library file, includes:

[0080] S302, in response to detecting the existence of the dynamic library interface according to the instruction dictionary, the library file is determined to be the target library file.

[0081] S304, the pre-created instance object is deserialized through the configuration file and the target library file to obtain a functional module object, wherein the instance object is created based on the functional functions in the module interface.

[0082] Specifically, the function entries in the instruction dictionary are typically used to detect the existence of dynamic library interfaces. If a dynamic library interface is detected in a functional module, then the functional module can be determined to be valid. The processing can be performed using the method described in the embodiments of this disclosure, where the library file corresponding to the aforementioned functional module can be the target library file. Since no code modification is required in this case, an instance object can be created, and then the instance object is deserialized from the configuration file and the target library file into a functional module object. Furthermore, since the instance object needs to be deserialized to form a functional module object, it can then implement the functionality of the functional module. Therefore, the instance object can be created based on the function entries in the module interface; for example, if there are three function entries, then typically there can also be three instance objects.

[0083] Additionally, it should be noted that traditional serialized XML or JSON files can only store data content suitable for storage and cannot store the functional differences between different functional modules. For example, two functional modules may have data A and B, but the two functional modules may process the above data in different ways. The execute() function in functional module one processes data A+B, while the execute() function in functional module two processes data AB. Therefore, corresponding instance objects can be created through functional functions, and deserialization can be performed using various information from configuration files and target library files. This allows for the differentiation of different function functions, thereby realizing the functional differences between different functional modules.

[0084] In some exemplary embodiments, the existence of a dynamic library interface can be detected by using GetInterface(IBlockLibraryInterface) in Assembly, thereby determining whether it is the target library file.

[0085] In this embodiment, by using an instruction dictionary for detection, library files can be filtered to identify those that meet the specifications and remove other types of library files, thus preventing the software system from using incorrect library files and causing system crashes.

[0086] In one embodiment, the dynamic interface library includes an object return function. This object return function may be `GetBlockInstance()`. This function provides the ability to obtain an instance object, returning the instance object (i.e., the functional module object) deserialized from the XML configuration file. It may also contain parameter data and interface functions stored in the configuration file for later use. The step of deserializing the pre-created instance object using the configuration file and the target library file to obtain the functional module object includes:

[0087] The pre-created actual object can be deserialized through configuration files and target library files, and then the functional module object can be output through the object return function.

[0088] In this embodiment, the function that returns an object can output a functional module object, which makes it easier to add the functional module to the module list and facilitates the software system to call it.

[0089] In one embodiment, such as Figure 6 As shown, the method further includes:

[0090] S402, in response to the fact that the functional module to be loaded has multiple configuration files, wherein the multiple configuration files correspond to a library file.

[0091] S404, Select the target configuration file from the multiple configuration files, and deserialize the target configuration file and the target library file to obtain the functional module object.

[0092] Specifically, typically, due to differences in the version or applicable scenarios of functional modules, a single functional module may correspond to different configuration files. Therefore, when multiple corresponding configuration files exist for a functional module that needs to be loaded, the following steps can be taken: Since the library file for a functional module is usually unique, multiple configurations typically correspond to a single library file. Based on some preset rules, a configuration file can be selected as the target configuration file. Then, the target configuration file and the target library file are deserialized to obtain the functional module object.

[0093] In this embodiment, when multiple configuration files exist, one of them can be selected as the target configuration file. This ensures that the final functional module corresponds to the same information in the determined configuration file, thereby ensuring that the implemented function meets the requirements.

[0094] In one embodiment, the dynamic library interface may also include a version information retrieval function, which could be `GetVersion()`. This version information retrieval function provides a standardized interface for obtaining the version of a functional module, facilitating version verification before using the functional module. Figure 7 As shown, the method further includes:

[0095] S502, obtain the version information of the functional module corresponding to the functional module object based on the version information acquisition function;

[0096] S504, in response to the version information being different from the predetermined version information, the configuration file is redefined.

[0097] Specifically, a version information retrieval function can be used to obtain the version information of the functional module corresponding to the functional module object. This version information is then output to the terminal. The terminal can compare the received version information with pre-determined version information. When the received version information differs from the pre-determined version information, it can be determined that the obtained configuration file is incorrect. As mentioned in the above embodiments, there may be multiple configuration files, and an incorrect configuration file may have been obtained, or the configuration file itself may be incorrect. Therefore, the configuration corresponding to the functional module that needs to be loaded can be re-determined, and the processing can be repeated using the method mentioned in the above embodiments.

[0098] In this embodiment, version information can be used to verify functional modules. When the version information is different, it can be determined that the configuration file is selected incorrectly, which can ensure that the functional modules loaded into the software system meet the requirements.

[0099] In one embodiment, such as Figure 8 As shown, this disclosure also provides another method for loading functional modules, the method comprising:

[0100] S602, obtain the file list directory, find the files in each file list directory, and add the file path of the configuration file in each file list directory to the list xmlFileList. The functional module to be loaded predefines a dynamic library interface and a module interface. The module interface includes function calls to implement the functionality of the functional module. The dynamic library interface includes an object return function. The dynamic library interface also includes a version information retrieval function.

[0101] S604 determines the corresponding configuration file in the xmlFileList list based on the information of the functional modules to be loaded, and then determines the corresponding library file from the dynamic library directory based on the configuration file.

[0102] S606, the library file is converted into a binary library file, and the binary library file is loaded as an instruction dictionary.

[0103] S608, in response to detecting the existence of the dynamic library interface according to the instruction dictionary, the library file is determined to be the target library file.

[0104] S610, the pre-created instance object is deserialized through the configuration file and the target library file, and the functional module object is output through the object return function, wherein the instance object is created based on the functional functions in the module interface.

[0105] S612, in response to the fact that the functional module to be loaded has multiple configuration files, wherein the multiple configuration files correspond to a library file.

[0106] S614, Select the target configuration file from the multiple configuration files, and deserialize the target configuration file and the target library file to obtain the functional module object.

[0107] S616, obtain the version information of the functional module corresponding to the functional module object based on the version information acquisition function.

[0108] S618, in response to the version information being different from the predetermined version information, the configuration file is redefined.

[0109] For specific implementation methods and limitations in this embodiment, please refer to the above embodiments, which will not be repeated here.

[0110] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0111] Based on the same inventive concept, this disclosure also provides a functional module loading apparatus for implementing the functional module loading method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more functional module loading apparatus embodiments provided below can be found in the limitations of the functional module loading method described above, and will not be repeated here.

[0112] In one embodiment, such as Figure 9 As shown, a function module loading device 700 is provided, including: a file determination module 702, a deserialization module 704, and a function loading module 706, wherein:

[0113] The file determination module 702 is used to determine the configuration file and library file corresponding to the functional module to be loaded as needed, wherein the functional module to be loaded has a predefined dynamic library interface.

[0114] Deserialization module 704 is used to deserialize the configuration file and the target library file to obtain a functional module object in response to determining that the library file is a target library file according to the dynamic library interface;

[0115] The function loading module 706 is used to add the function module object to the module list list, and the module objects in the module list list are used for the software system to call.

[0116] In one embodiment of the device, the document determination module 702 includes:

[0117] The configuration list processing module is used to obtain the file list directory of the software system;

[0118] The configuration file determination module is used to locate the files in each file list directory, add the file paths of the configuration files in each file list directory to the configuration list, and determine the corresponding configuration file based on the information from the functional module and the configuration list.

[0119] The library file determination module is used to determine the corresponding library file from the file list directory based on the configuration file.

[0120] In one embodiment of the device, the device further includes: a data conversion module for converting the library file into a binary library file and loading the binary library file into an instruction dictionary.

[0121] In one embodiment of the device, the functional module to be loaded also has a predefined module interface, which includes function calls used to implement the functionality of the functional module. The deserialization module 704 includes:

[0122] The detection module is used to determine the library file as the target library file in response to the detection of the existence of the dynamic library interface based on the instruction dictionary.

[0123] The processing module is used to deserialize the pre-created instance object through the configuration file and the target library file to obtain the functional module object, wherein the instance object is created based on the functional functions in the module interface.

[0124] In one embodiment of the device, the dynamic library interface includes an object return function. The processing module is further configured to deserialize a pre-created instance object using the configuration file and the target library file, and output the functional module object via the object return function.

[0125] In one embodiment of the device, the deserialization module 704 is further configured to, in response to the existence of multiple configuration files for the functional module to be loaded, wherein the multiple configuration files correspond to a library file; select a target configuration file from the multiple configuration files; and perform deserialization based on the target configuration file and the target library file to obtain a functional module object.

[0126] In one embodiment of the device, the dynamic library interface further includes a version information acquisition function, and the device further includes: a verification module, used to acquire the version information of the functional module corresponding to the functional module object based on the version information acquisition function; and to re-determine the configuration file in response to the version information being different from the predetermined version information.

[0127] Each module in the aforementioned functional module loading device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0128] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 10 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores configuration files and library files. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a functional module loading method.

[0129] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present disclosure and does not constitute a limitation on the computer device to which the present disclosure is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0130] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in any of the above method embodiments.

[0131] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in any of the above method embodiments.

[0132] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0133] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this disclosure may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this disclosure may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0134] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0135] The embodiments described above are merely illustrative of several implementations of this disclosure, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent disclosure. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this disclosure, and these all fall within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the appended claims.

Claims

1. A method for loading functional modules, characterized in that, The method includes: Based on the functional modules to be loaded, determine the configuration files and library files corresponding to the functional modules. The functional modules to be loaded predefine dynamic library interfaces and module interfaces. The dynamic library interfaces include object return functions and version information retrieval functions. The module interfaces include functional functions used to implement the functions of the functional modules. In response to the detection of the existence of the dynamic library interface based on the instruction dictionary, the library file is determined to be the target library file. The instance object pre-created based on the function is deserialized through the configuration file and the target library file, and the function module object is output through the object return function. The version information is obtained based on the version information acquisition function; if the version information is different from the predetermined version information, the configuration file is re-determined. The functional module object is added to the module list, and the module objects in the module list are used for the software system to call.

2. The method according to claim 1, characterized in that, Before determining that the library file is the target library file based on the dynamic library interface, the method further includes: The library file is converted into a binary library file, and the binary library file is loaded as an instruction dictionary.

3. The method according to claim 1, characterized in that, The method further includes: In response to the existence of multiple configuration files for the functional modules that need to be loaded, wherein each of the multiple configuration files corresponds to a library file; Select the target configuration file from the multiple configuration files, and deserialize the target configuration file and the target library file to obtain the functional module object.

4. The method according to claim 1, characterized in that, The step of determining the configuration file and library file corresponding to the functional module includes: Obtain the file list directory of the software system; Locate the files in each file list directory and add the file path of the configuration file in each file list directory to the configuration list; The corresponding configuration file is determined based on the information of the functional modules and the configuration list; The corresponding library files are determined from the file list directory based on the configuration file.

5. A functional module loading device, characterized in that, The device includes: The file determination module is used to determine the configuration file and library file corresponding to the functional module to be loaded as needed. The functional module to be loaded has a predefined dynamic library interface and a module interface. The dynamic library interface includes an object return function and a version information acquisition function. The module interface includes a function to implement the function of the functional module. The deserialization module is used to respond to the detection of the existence of the dynamic library interface according to the instruction dictionary, determine the library file as the target library file, deserialize the instance object pre-created based on the function through the configuration file and the target library file, and output the function module object through the object return function; The verification module is used to obtain the version information of the functional module corresponding to the functional module object based on the version information acquisition function; and to re-determine the configuration file in response to the version information being different from the pre-determined version information. The function loading module is used to add the function module object to the module list list, and the module objects in the module list list are used for the software system to call.

6. The apparatus according to claim 5, characterized in that, The device further includes a data conversion module for converting the library file into a binary library file and loading the binary library file into an instruction dictionary.

7. The apparatus according to claim 5, characterized in that, The deserialization module is further configured to respond to the existence of multiple configuration files for the functional module to be loaded, wherein the multiple configuration files correspond to a library file; select a target configuration file from the multiple configuration files, and perform deserialization based on the target configuration file and the target library file to obtain the functional module object.

8. The apparatus according to claim 5, characterized in that, The file determination module includes: The configuration list processing module is used to obtain the file list directory of the software system; The configuration file determination module is used to locate the files in each file list directory, add the file paths of the configuration files in each file list directory to the configuration list, and determine the corresponding configuration file based on the information from the functional module and the configuration list. The library file determination module is used to determine the corresponding library file from the file list directory based on the configuration file.

9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Software running method and device, electronic equipment and storage medium

    CN114327474A

  • Application program loading method and device, computer equipment and storage medium

    CN115454535A