External shared library dynamic loading method and device, equipment and medium

By obtaining a list of external shared library files and parsing system error information, and dynamically adjusting the loading order, the problem of automatically obtaining the dependencies of external shared library files is solved, achieving efficient and reliable loading of external shared libraries on the Android platform.

CN121478375APending Publication Date: 2026-02-06SHENZHEN CITY ZHITONG INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511637331.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-10
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

In the Android platform, the dependencies between external shared library files are complex, making it difficult for developers to automatically obtain the correct loading order, which can lead to application crashes. Existing technologies rely on manual analysis or communication to obtain dependency information, which increases the complexity and cost of development and debugging.

Method used

By obtaining a list of external shared library files, loading and parsing system error information sequentially, dynamically adjusting the loading order, building a self-correcting closed loop, automatically identifying missing dependencies and optimizing the loading order, intelligent loading without manual prediction is achieved.

Benefits of technology

It improves the success rate and development efficiency of loading external shared libraries, reduces the technical threshold and maintenance costs, and achieves a high degree of automation and intelligence in the loading process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121478375A_ABST
    Figure CN121478375A_ABST
Patent Text Reader

Abstract

The invention discloses an external shared library dynamic loading method and device, equipment and a medium, and relates to the technical field of external shared library dynamic loading, and the method comprises the following steps: obtaining a file list of a plurality of external shared library files to be loaded; according to the sequence of the file list, selecting a target external shared library file from the plurality of external shared library files in sequence, and loading the target external shared library file to a preset target system; if the target external shared library file fails to be loaded, analyzing a missing dependent shared library file from error information returned by the target system; judging whether the dependent shared library file is in a file list or not; and if the dependent shared library file is in the file list, adjusting the sequence of the dependent shared library file in the file list to be in front of the target external shared library file, and reloading the dependent shared library file. According to the method, high automation and intelligence of the loading process can be achieved on the premise that the dependency relationship does not need to be pre-judged manually, the loading success rate and the development efficiency are remarkably improved, and the technical threshold and the maintenance cost are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of dynamic loading technology for external shared libraries, and in particular to a method, apparatus, device, and medium for dynamic loading of external shared libraries. Background Technology

[0002] In the current mobile application development field, especially on the Android platform, in order to meet the strict limitations on the size of application installation packages, moving some shared library files (i.e., .so files) from the application to external storage and dynamically loading them at runtime has become a common and effective weight reduction solution.

[0003] The above solution still has obvious shortcomings in actual implementation. Specifically, since there are often complex dependencies between external shared library files, and developers usually cannot know these dependency structures before loading, if the dependencies are not loaded in the correct order, the system will throw an exception because it cannot resolve symbols, causing the application to crash.

[0004] To address this issue, existing technologies typically rely on developers manually analyzing the dependency chains between various .so files or communicating with library providers to obtain loading order information. Regardless of the method used, when dealing with a large number of shared libraries, a significant amount of time and effort is required to systematically check and prioritize them through trial and error. This process not only has a high technical threshold but also significantly increases the complexity and manpower costs of development and debugging. Summary of the Invention

[0005] This invention provides a method, apparatus, device, and medium for dynamically loading external shared libraries. The technical problem it aims to solve is: how to achieve efficient and reliable loading of external shared libraries without relying on manual intervention to pre-acquire and organize dependencies, thereby effectively improving development efficiency and reducing the technical cost of the loading process.

[0006] In a first aspect, embodiments of the present invention provide a method for dynamically loading an external shared library, comprising: Get a list of files for multiple external shared library files to be loaded; According to the order of the file list, target external shared library files are selected from the plurality of external shared library files and loaded into the preset target system in sequence; If the target external shared library file fails to load, the missing dependent shared library file is parsed from the error message returned by the target system; Determine whether the dependent shared library file is in the file list; If the dependent shared library file is in the file list, the order of the dependent shared library file in the file list is adjusted to before the target external shared library file, and then proceed to the step of selecting the target external shared library file from the plurality of external shared library files in the order of the file list and loading it into the preset target system.

[0007] Optionally, obtaining the file list of multiple external shared library files to be loaded includes: Scan the file directories under the preset storage path; Record and store the names of all files in the file directory that match the preset file extension to form the file list.

[0008] Optionally, the list of files is stored in an array.

[0009] Optionally, parsing the missing dependent shared library files from the error information returned by the target system includes: Extract the string enclosed by a preset delimiter from the error message; The string is identified as the name of the dependent shared library file.

[0010] Optionally, the method further includes: If the required shared library file is not in the file list, loading will stop and an error will be reported.

[0011] Optionally, the reported error includes: An error message is generated based on the string; The error message is sent to the preset caller.

[0012] Optionally, the method further includes: If the target external shared library file is loaded successfully, the target external shared library file will be removed from the file list; The step of adjusting the order of the dependent shared library files in the file list to before the target external shared library file includes: Adjust the order of the dependent shared library files in the file list to the first position.

[0013] Secondly, embodiments of the present invention also provide an external shared library dynamic loading device, which includes a unit for performing the above-described method.

[0014] Thirdly, embodiments of the present invention also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.

[0015] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the above-described method.

[0016] This invention provides a method, apparatus, device, and medium for dynamically loading external shared libraries. The method includes: obtaining a file list of multiple external shared library files to be loaded; selecting a target external shared library file from the multiple external shared library files according to the order of the file list and loading it into a preset target system; if the loading of the target external shared library file fails, parsing the missing dependent shared library file from the error information returned by the target system; determining whether the dependent shared library file is in the file list; if the dependent shared library file is in the file list, adjusting the order of the dependent shared library file in the file list to before the target external shared library file, and proceeding to the step of selecting the target external shared library file from the multiple external shared library files according to the order of the file list and loading it into the preset target system. By constructing a self-correcting closed loop of "detecting loading - parsing errors - dynamically adjusting - iteratively optimizing," a fundamental change is achieved in the external shared library loading process. This method can automatically and accurately identify missing dependencies from system errors, intelligently determine the nature of the problem, and dynamically reconstruct the loading sequence. By using recursive closed-loop control, the loading order adaptively evolves to the optimal state during iteration. Ultimately, without the need for manual prediction of dependencies, a high degree of automation and intelligence in the loading process is achieved, significantly improving the loading success rate and development efficiency, while reducing the technical threshold and maintenance costs. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating a method for dynamically loading an external shared library, provided in an embodiment of the present invention; Figure 2 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0021] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0022] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0023] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."

[0024] Please see Figure 1 This invention provides a method for dynamically loading external shared libraries, which includes the following steps: S1, obtain a file list of multiple external shared library files to be loaded.

[0025] In practice, a file list of multiple external shared library files to be loaded is obtained, establishing a unified and clear set of operation objects for all subsequent automated operations, thus achieving standardized management of loading targets. This embodiment of the invention integrates scattered external shared library files into a data structure that can be processed sequentially by the program, providing a foundation for automated processes and avoiding incomplete loading due to scattered or missing files, ensuring the integrity of the loading task from the source.

[0026] In some preferred embodiments, the above step "obtaining a file list of multiple external shared library files to be loaded" specifically includes the following steps: scanning the file directory under the preset storage path; recording and storing the file names of all files in the file directory that match the preset file extension to form the file list.

[0027] In practical implementation, this invention forcibly standardizes the storage location of shared library files, eliminating the risk of omissions caused by files being scattered in various places, and providing a stable and reliable input source for the entire loading process. Furthermore, by recording and storing the names of all files that conform to the preset file extension, automatic identification and batch import of target files are achieved.

[0028] For example, by setting the default file extension to ".so", the system can automatically filter out all relevant shared library files in the directory, eliminating the need for developers to manually check and enter the file names one by one. This automated collection mechanism not only avoids omissions and mis-entry problems that may occur with manual operation, but also ensures the completeness of the file list, thus laying the foundation for a higher success rate in subsequent loading.

[0029] Furthermore, the embodiments of the present invention also greatly simplify the preparation work for developers. Developers only need to ensure that the files are stored in the specified location, without having to worry about the details of list construction, so that the entire solution has the characteristics of high efficiency and accuracy from the initialization stage.

[0030] In some preferred embodiments, the list of files is stored in an array.

[0031] In practical implementation, arrays, as a data structure stored contiguously in memory, offer the significant advantage of supporting random access via indexes. In the frequently performed operations described in this embodiment, arrays provide extremely high performance. When the order of dependent shared library files needs to be adjusted to precede or precede the target external shared library file, although element movement may be involved, the contiguous storage characteristic of array elements ensures high efficiency in memory movement, especially in conjunction with the caching mechanisms of modern processors. Therefore, using arrays as the storage structure achieves optimal overall performance throughout the loading process, ensuring smooth and efficient dynamic loading even when processing a large number of shared library files, and avoiding performance bottlenecks that may arise from inappropriate data structure selection.

[0032] S2, according to the order of the file list, select the target external shared library file from the plurality of external shared library files and load it into the preset target system. The target system is, for example, the Android system, but this invention is not specifically limited.

[0033] In specific implementation, the step of "selecting target external shared library files from the multiple external shared library files sequentially according to the order of the file list and loading them into the preset target system" initiates the core loading loop, establishing a systematic detection mechanism. This embodiment of the invention no longer relies on a pre-input perfect dependency order, but instead uses an initial order (which can be arbitrary) as a starting point, actively probing the system's response through actual loading actions. This detection process effectively exposes existing dependencies, concretizing implicit and unknown dependency chains through the system's runtime behavior, providing a real basis for subsequent intelligent decision-making.

[0034] S3, if the target external shared library file fails to load, the missing dependent shared library file is parsed from the error information returned by the target system.

[0035] In practical implementation, when the target external shared library file fails to load, the step of "parseing the missing dependent shared library file from the error information returned by the target system" demonstrates one of the core intelligences of the solution, achieving a precise conversion from unstructured fault signals to structured clues to solutions. The error information typically contains a large amount of text, but this embodiment uses specific parsing logic (e.g., matching specific delimiters) to accurately extract the key entity causing the failure—the name of the missing dependent shared library file. This is equivalent to giving the system the ability to understand the root cause of the error, rather than merely perceiving the state of failure, thus transforming a failure event into a valuable input pointing to a solution.

[0036] In some preferred embodiments, the above step "parse the missing dependent shared library file from the error information returned by the target system" specifically includes the following steps: extracting the string surrounded by a preset delimiter in the error information; and identifying the string as the name of the dependent shared library file.

[0037] In practice, error messages are typically unstructured natural language strings intended for developers, making it challenging to extract key information directly. This solution introduces a stable and reliable anchor point for the parsing process through the feature of "preset delimiters." For example, in error messages from many systems (such as Android), missing library names are often enclosed in double quotes. By locating these preset delimiters, this method can accurately extract the library name string within them, effectively eliminating interference from other irrelevant words, path information, or descriptive text in the error message. The robustness of this method lies in the fact that as long as the delimiter pattern is fixed, the parsing logic will still work accurately even if other parts of the error message change due to different system versions or language environments. It avoids the use of complex and error-prone regular expressions or natural language processing techniques, achieving a reliable conversion from unstructured error messages to structured data (depending on the names of shared library files) in a lightweight and low-cost manner. This accurate and stable parsing is the foundation for all subsequent intelligent decisions (judgments, order adjustments), ensuring the correct operation of the entire automated process.

[0038] S4, determine whether the dependent shared library file is in the file list.

[0039] In practice, the step of "determining whether the dependent shared library file is in the file list" plays a crucial logical decision-making role, accurately classifying the problem and distinguishing between two different types of issues: "incorrect order" and "missing resources." If the dependent shared library file exists, the problem is essentially an improper loading order; if the dependent shared library file does not exist, it means a fundamental lack of resources. This judgment forms the basis for subsequent branch operations, ensuring the targeted and correct nature of the system response and avoiding meaningless order adjustments in the event of resource shortages.

[0040] S5, if the dependent shared library file is in the file list, adjust the order of the dependent shared library file in the file list to before the target external shared library file, and proceed to the step of selecting the target external shared library file from the plurality of external shared library files in the order of the file list and loading it into the preset target system.

[0041] In practical implementation, after confirming the existence of the dependent shared library file, the step of "adjusting the order of the dependent shared library file in the file list to before the target external shared library file" performs a substantial correction action, realizing adaptive reconstruction of the loading sequence. Based on the newly discovered dependencies, this embodiment dynamically modifies the order of the file list, placing the dependent (the dependent shared library file) before the dependent (the target external shared library file), directly resolving the exposed order contradiction. This adjustment is not a one-time event, but rather embedded in a larger loop, allowing the loading order to continuously evolve as more dependencies are discovered, gradually approaching and ultimately forming the correct loading sequence.

[0042] Finally, the step of "returning to the step of sequentially selecting target external shared library files from the plurality of external shared library files according to the order of the file list and loading them into the preset target system" constitutes the closed-loop control and iterative engine of the scheme, giving the entire method the ability to self-correct and continuously optimize. By returning the execution flow to the beginning of the loading loop, the system can restart the probing based on an updated and better file list. This process can iterate multiple times, with each iteration potentially resolving a dependency conflict, until all dependencies are satisfied and all files are loaded successfully. This iterative mechanism ensures that the method can handle dependency networks of arbitrary complexity without any prior knowledge of the network structure.

[0043] In some preferred embodiments, the method further includes: if the target external shared library file is successfully loaded, removing the target external shared library file from the file list. Further, the step "adjusting the order of the dependent shared library files in the file list to before the target external shared library file" specifically includes the following step: adjusting the order of the dependent shared library files in the file list to the first position.

[0044] In practice, firstly, the action of "removing the target external shared library file from the file list if the target external shared library file is successfully loaded" makes the file list a dynamically shrinking set, which brings multiple benefits: it ensures that each shared library file is successfully loaded only once, avoiding duplicate loading of resources and potential conflicts; at the same time, as the file list continues to shrink, the number of elements that need to be traversed and processed in each subsequent loading loop continues to decrease, thereby gradually improving the execution efficiency of the loop and accelerating the convergence of the entire process towards the completion state.

[0045] Furthermore, prioritizing the dependent shared library file in the file list is an optimal sorting strategy. Since this dependent shared library file is the root cause of the current loading failure, placing it first ensures that it will be attempted to load in the next loading iteration. This is equivalent to always prioritizing the resolution of the most urgent and fundamental dependencies, clearing obstacles for loading other modules subsequently. This strategy can satisfy the lowest level of the dependency chain most quickly, potentially resolving multiple upper-level module loading failures caused by the missing low-level dependency in one go.

[0046] In some preferred embodiments, the method further includes the following step: if the dependent shared library file is not in the file list, then stop loading and report an error.

[0047] In practical implementation, a crucial consideration during automated recursive or loop loading is avoiding infinite loops or meaningless repeated attempts. By setting the condition "stop loading if the dependent shared library file is not in the file list," this embodiment of the invention clearly defines a termination line for the automatic loading process. This indicates that the system can intelligently identify that the current problem cannot be solved through internal adjustments (order reordering), and the nature of the problem changes from "sequentially solvable dependency missing" to "fundamental resource missing." At this point, immediately stopping loading prevents the system from continuing futile loading attempts that could trigger a chain of errors when critical components are missing, saving computing resources and avoiding the risk of system instability or crashes caused by repeated attempts to load missing modules.

[0048] Furthermore, the "reporting errors" action provides developers with crucial feedback, promptly and explicitly exposing the system's internal state (unresolved dependency gaps) to external controllers.

[0049] In some preferred embodiments, the above step of "reporting errors" specifically includes the following steps: generating error message based on the string; and sending the error message to a preset caller.

[0050] In practice, during complex debugging processes, vague or generalized error messages often become a major obstacle to problem-solving. This invention generates error messages directly based on the precisely parsed dependency library name string (e.g., "libhmp.so") from system errors. This ensures that the reported information directly points to the root cause of the problem—specifically, which shared library file is missing. Compared to simply reporting a general "load failed" or a raw system error log, this customized error message significantly reduces the parsing cost for developers. Developers no longer need to manually sift through lengthy system logs that may contain technical jargon and guess the missing filename; instead, they directly obtain a clear, machine-readable identifier pointing to the specific missing object. This allows developers to quickly locate the problem and take targeted remedial measures, such as checking if the file was accidentally deleted, if the path is correct, or if the dependency library needs to be downloaded again.

[0051] This invention proposes a method for dynamically loading external shared libraries, comprising: obtaining a file list of multiple external shared library files to be loaded; selecting target external shared library files from the multiple external shared library files according to the order of the file list and loading them into a preset target system; if the loading of the target external shared library file fails, parsing the missing dependent shared library files from the error information returned by the target system; determining whether the dependent shared library files are in the file list; if the dependent shared library files are in the file list, adjusting the order of the dependent shared library files in the file list to before the target external shared library files, and proceeding to the step of selecting target external shared library files from the multiple external shared library files according to the order of the file list and loading them into the preset target system. By constructing a self-correcting closed loop of "detecting loading - parsing errors - dynamically adjusting - iteratively optimizing", a fundamental change is achieved in the external shared library loading process. This method can automatically and accurately identify missing dependencies from system errors, intelligently determine the nature of the problem, and dynamically reconstruct the loading sequence. By using recursive closed-loop control, the loading order adaptively evolves to the optimal state during iteration. Ultimately, without the need for manual prediction of dependencies, a high degree of automation and intelligence in the loading process is achieved, significantly improving the loading success rate and development efficiency, while reducing the technical threshold and maintenance costs.

[0052] Corresponding to the above-described method for dynamically loading external shared libraries, this invention also provides an apparatus for dynamically loading external shared libraries. This apparatus includes a unit for executing the aforementioned method for dynamically loading external shared libraries, and can be configured in a desktop computer, tablet computer, laptop computer, or other terminal. Specifically, the apparatus includes: The acquisition unit is used to obtain a file list of multiple external shared library files to be loaded; The loading unit is used to select target external shared library files from the plurality of external shared library files in the order of the file list and load them into a preset target system. The parsing unit is used to parse out the missing dependent shared library files from the error information returned by the target system if the target external shared library file fails to load. The determination unit is used to determine whether the dependent shared library file is in the file list; The jump unit is used to, if the dependent shared library file is in the file list, adjust the order of the dependent shared library file in the file list to be before the target external shared library file, and then jump to the step of selecting the target external shared library file from the plurality of external shared library files in the order of the file list and loading it into the preset target system.

[0053] In some preferred embodiments, obtaining the file list of multiple external shared library files to be loaded includes: Scan the file directories under the preset storage path; Record and store the names of all files in the file directory that match the preset file extension to form the file list.

[0054] In some preferred embodiments, the list of files is stored in an array.

[0055] In some preferred embodiments, parsing the missing dependent shared library files from the error information returned by the target system includes: Extract the string enclosed by a preset delimiter from the error message; The string is identified as the name of the dependent shared library file.

[0056] In some preferred embodiments, it further includes: The stop unit is used to stop loading and report an error if the dependent shared library file is not in the file list.

[0057] In some preferred embodiments, the reported error includes: An error message is generated based on the string; The error message is sent to the preset caller.

[0058] In some preferred embodiments, it further includes: The removal unit removes the target external shared library file from the file list if the target external shared library file is successfully loaded. The step of adjusting the order of the dependent shared library files in the file list to before the target external shared library file includes: Adjust the order of the dependent shared library files in the file list to the first position.

[0059] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned external shared library dynamic loading device and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.

[0060] The aforementioned external shared library dynamic loading device can be implemented as a computer program, which can, for example, Figure 2 It runs on the computer device shown.

[0061] Please see Figure 2 , Figure 2 This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device 500 can be a terminal or a server. The terminal can be an electronic device with communication functions, such as a smartphone, tablet, laptop, desktop computer, personal digital assistant, or wearable device. The server can be a standalone server or a server cluster composed of multiple servers.

[0062] The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a system bus 501. The memory may include a non-volatile storage medium 503 and internal memory 504.

[0063] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, it causes the processor 502 to execute a method for dynamically loading external shared libraries.

[0064] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.

[0065] The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute an external shared library dynamic loading method.

[0066] The network interface 505 is used for network communication with other devices. Those skilled in the art will understand that the above structure is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 500 to which the present application is applied. A specific computer device 500 may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements.

[0067] The processor 502 is used to run a computer program 5032 stored in the memory to perform the following steps: Get a list of files for multiple external shared library files to be loaded; According to the order of the file list, target external shared library files are selected from the plurality of external shared library files and loaded into the preset target system in sequence; If the target external shared library file fails to load, the missing dependent shared library file is parsed from the error message returned by the target system; Determine whether the dependent shared library file is in the file list; If the dependent shared library file is in the file list, the order of the dependent shared library file in the file list is adjusted to before the target external shared library file, and then proceed to the step of selecting the target external shared library file from the plurality of external shared library files in the order of the file list and loading it into the preset target system.

[0068] In some preferred embodiments, obtaining the file list of multiple external shared library files to be loaded includes: Scan the file directories under the preset storage path; Record and store the names of all files in the file directory that match the preset file extension to form the file list.

[0069] In some preferred embodiments, the list of files is stored in an array.

[0070] In some preferred embodiments, parsing the missing dependent shared library files from the error information returned by the target system includes: Extract the string enclosed by a preset delimiter from the error message; The string is identified as the name of the dependent shared library file.

[0071] In some preferred embodiments, the method further includes: If the required shared library file is not in the file list, loading will stop and an error will be reported.

[0072] In some preferred embodiments, the reported error includes: An error message is generated based on the string; The error message is sent to the preset caller.

[0073] In some preferred embodiments, the method further includes: If the target external shared library file is loaded successfully, the target external shared library file will be removed from the file list; The step of adjusting the order of the dependent shared library files in the file list to before the target external shared library file includes: Adjust the order of the dependent shared library files in the file list to the first position.

[0074] It should be understood that in the embodiments of this application, the processor 502 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0075] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program may be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0076] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program. When executed by a processor, the computer program causes the processor to perform the following steps: Get a list of files for multiple external shared library files to be loaded; According to the order of the file list, target external shared library files are selected from the plurality of external shared library files and loaded into the preset target system in sequence; If the target external shared library file fails to load, the missing dependent shared library file is parsed from the error message returned by the target system; Determine whether the dependent shared library file is in the file list; If the dependent shared library file is in the file list, the order of the dependent shared library file in the file list is adjusted to before the target external shared library file, and then proceed to the step of selecting the target external shared library file from the plurality of external shared library files in the order of the file list and loading it into the preset target system.

[0077] In some preferred embodiments, obtaining the file list of multiple external shared library files to be loaded includes: Scan the file directories under the preset storage path; Record and store the names of all files in the file directory that match the preset file extension to form the file list.

[0078] In some preferred embodiments, the list of files is stored in an array.

[0079] In some preferred embodiments, parsing the missing dependent shared library files from the error information returned by the target system includes: Extract the string enclosed by a preset delimiter from the error message; The string is identified as the name of the dependent shared library file.

[0080] In some preferred embodiments, the method further includes: If the required shared library file is not in the file list, loading will stop and an error will be reported.

[0081] In some preferred embodiments, the reported error includes: An error message is generated based on the string; The error message is sent to the preset caller.

[0082] In some preferred embodiments, the method further includes: If the target external shared library file is loaded successfully, the target external shared library file will be removed from the file list; The step of adjusting the order of the dependent shared library files in the file list to before the target external shared library file includes: Adjust the order of the dependent shared library files in the file list to the first position.

[0083] The storage medium is a physical, non-transient storage medium, such as a USB flash drive, external hard drive, read-only memory (ROM), magnetic disk, or optical disk, or any other physical storage medium capable of storing program code. The computer-readable storage medium can be non-volatile or volatile.

[0084] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0085] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0086] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0087] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0088] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0089] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Since these modifications and variations fall within the scope of the claims and their equivalents, this invention also intends to include these modifications and variations.

[0090] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for dynamically loading external shared libraries, characterized in that, include: Get a list of files for multiple external shared library files to be loaded; According to the order of the file list, target external shared library files are selected from the plurality of external shared library files and loaded into the preset target system in sequence; If the target external shared library file fails to load, the missing dependent shared library file is parsed from the error message returned by the target system; Determine whether the dependent shared library file is in the file list; If the dependent shared library file is in the file list, the order of the dependent shared library file in the file list is adjusted to before the target external shared library file, and then proceed to the step of selecting the target external shared library file from the plurality of external shared library files in the order of the file list and loading it into the preset target system.

2. The method for dynamically loading external shared libraries according to claim 1, characterized in that, The process of obtaining the file list of multiple external shared library files to be loaded includes: Scan the file directories under the preset storage path; Record and store the names of all files in the file directory that match the preset file extension to form the file list.

3. The method for dynamically loading external shared libraries according to claim 2, characterized in that, The list of files is stored in an array.

4. The method for dynamically loading external shared libraries according to claim 1, characterized in that, The step of parsing the missing dependent shared library files from the error information returned by the target system includes: Extract the string enclosed by a preset delimiter from the error message; The string is identified as the name of the dependent shared library file.

5. The method for dynamically loading external shared libraries according to claim 4, characterized in that, The method further includes: If the required shared library file is not in the file list, loading will stop and an error will be reported.

6. The method for dynamically loading external shared libraries according to claim 5, characterized in that, The reported errors include: An error message is generated based on the string; The error message is sent to the preset caller.

7. The method for dynamically loading external shared libraries according to claim 4, characterized in that, The method further includes: If the target external shared library file is loaded successfully, the target external shared library file will be removed from the file list; The step of adjusting the order of the dependent shared library files in the file list to before the target external shared library file includes: Adjust the order of the dependent shared library files in the file list to the first position.

8. A dynamic loading device for external shared libraries, characterized in that, Includes a unit for performing the method as described in any one of claims 1-7.

9. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, can implement the method as described in any one of claims 1-7.