Application program control method and apparatus

By injecting the first dynamic library into the application and loading the second dynamic library, using the second dynamic library to call the interface of the first dynamic library, the problem of in-depth control of the underlying functions of the application in the existing technology is solved, and the application is realized Fine control and extension of program functions.

WO2025025528A1PCT designated stage expired Publication Date: 2025-02-06JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/072324
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-07-28
Filing Date
2024-01-15
Publication Date
2025-02-06

AI Technical Summary

Technical Problem

In the prior art, plug-in extensions cannot penetrate into the underlying functions of the application, and dynamic library injection is not controlled by the application, making it difficult to effectively control and extend the underlying functions of the application.

Method used

By injecting the first dynamic library into the application through loading at startup and loading the second dynamic library into the application in a plug-in manner, in response to the completion of the first dynamic library injection and the completion of the second dynamic library loading, based on the second The dynamic library calls the specified interface provided by the first dynamic library to control the functions provided by the first dynamic library.

Benefits of technology

It realizes refined control and extension of the underlying functions of the application, avoiding the defect of uncontrolled injection of dynamic library, and at the same time, using plug-ins to improve the flexibility of function expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024072324_06022025_PF_FP_ABST
    Figure CN2024072324_06022025_PF_FP_ABST
Patent Text Reader

Abstract

An application program control method and apparatus, said method comprising: injecting a first dynamic library into an application program by means of loading at startup (201); loading, as a plug-in, a second dynamic library into the application program (202); and in response to determining that injection of the first dynamic library is complete and loading the second dynamic library is complete, on the basis of the second dynamic library, calling a specified interface provided by the first dynamic library, and controlling a function provided by the first dynamic library (203).
Need to check novelty before this filing date? Find Prior Art

Description

Application program control method and device

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This patent application claims priority to the Chinese patent application filed on July 28, 2023, with application number 202310942825.4 and invention name “Application Control Method and Device”, the full text of which is incorporated by reference into this disclosure. Technical Field

[0003] The present disclosure relates to the field of computer technology, specifically to the field of application development technology, and more particularly to an application control method and device. Background Art

[0004] In the existing technology, methods for dynamically extending application capabilities at runtime mainly include plug-in extensions and dynamic library injection. Plugin extensions are generally used to refer to plug-in technologies implemented using dynamic libraries. Dynamic library injection is a technique that uses "hooks" or other similar dynamic code injection techniques in the dynamic library to "hijack" or "overwrite" the original code in the application, or inject new code, to modify or extend the original application when the dynamic library is loaded.

[0005] However, plug-in extensions can generally only provide corresponding capability extensions based on the interface agreed upon between them and the application, and cannot go deeper into more underlying functions; although dynamic library injection can inject code into the application at runtime without being restricted by the plug-in interface, thereby going deep into the underlying functions of the application, dynamic library injection is not controlled by the application itself.

[0006] Summary of the Invention

[0007] Embodiments of the present disclosure provide an application control method, apparatus, device, and storage medium.

[0008] In one or more embodiments, an application control method is provided, which includes: injecting a first dynamic library into the application by loading it at startup; loading a second dynamic library into the application as a plug-in; in response to determining that the injection of the first dynamic library is complete and the loading of the second dynamic library is complete, based on the second dynamic library, calling a specified interface provided by the first dynamic library to control the functions provided by the first dynamic library.

[0009] In one or more embodiments, an application control device is provided, which includes: an injection module configured to inject a first dynamic library into the application by loading it at startup; a loading module configured to load a second dynamic library into the application as a plug-in; and a control module configured to, in response to determining that the injection of the first dynamic library is complete and the loading of the second dynamic library is complete, call a specified interface provided by the first dynamic library based on the second dynamic library to control the functions provided by the first dynamic library.

[0010] In one or more embodiments, an electronic device is provided, which includes one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement an application control method as described in any of the above embodiments.

[0011] In one or more embodiments, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the application control method of any of the above embodiments is implemented.

[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] FIG1 is a diagram of an exemplary system architecture in which the present disclosure may be applied;

[0014] FIG2 is a flow chart of an embodiment of an application control method according to the present disclosure;

[0015] FIG3 is an architectural diagram of an embodiment of an application control method according to the present disclosure;

[0016] FIG4 a is a flow chart of an embodiment of an application control method according to the present disclosure;

[0017] FIG4 b is a flow chart of an application scenario of the application control method according to the present disclosure;

[0018] FIG4c is a flow chart of another application scenario of the application control method according to the present disclosure;

[0019] FIG5 is a flow chart of an embodiment of an application control apparatus according to the present disclosure;

[0020] FIG6 is a schematic diagram of the structure of a computer system suitable for implementing a server according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0021] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding. These details should be considered as merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0022] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0023] FIG. 1 illustrates an exemplary system architecture 100 to which an embodiment of the application control method of the present disclosure may be applied.

[0024] As shown in Figure 1, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0025] The terminal devices 101, 102, 103 interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications, such as storage applications and communication applications, may be installed on the terminal devices 101, 102, 103.

[0026] Terminal devices 101, 102, and 103 can be hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with display screens, including but not limited to mobile phones and laptop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software or software modules (for example, to provide application control services), or as a single software or software module. No specific limitations are given here.

[0027] The server 105 may be a server that provides various services, for example, injecting a first dynamic library into an application by loading it at startup; loading a second dynamic library into an application as a plug-in; in response to determining that the injection of the first dynamic library is complete and the loading of the second dynamic library is complete, calling a specified interface provided by the first dynamic library based on the second dynamic library to control the functions provided by the first dynamic library.

[0028] It should be noted that the server 105 can be either hardware or software. When the server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules (for example, to provide application control services), or as a single software program or software module. No specific limitations are imposed herein.

[0029] It should be noted that the application control method provided in the embodiments of the present disclosure can be executed by the server 105, or by the terminal devices 101, 102, 103, or by the server 105 and the terminal devices 101, 102, 103 in cooperation with each other. Accordingly, the various parts (e.g., various units, sub-units, modules, and sub-modules) included in the application control apparatus can be all provided in the server 105, or all provided in the terminal devices 101, 102, 103, or provided separately in the server 105 and the terminal devices 101, 102, 103.

[0030] It should be understood that the number of terminal devices, networks, and servers in Figure 1 is merely illustrative and any number of terminal devices, networks, and servers may be provided as required.

[0031] FIG2 shows a process 200 of an embodiment of an application control method that can be applied to the present disclosure. In this embodiment, the application control method includes the following steps:

[0032] Step 201: inject the first dynamic library into the application by loading it at startup.

[0033] In this embodiment, the execution entity (such as the server 105 or the terminal devices 101 , 102 , 103 as shown in FIG1 ) may inject the first dynamic library into the application when the application is started.

[0034] Here, the first dynamic library injected into the application by the execution subject may override the code of the application itself or the code of the dynamic library that the application depends on, which is not limited in the present disclosure.

[0035] Specifically, in Linux systems, you can specify the environment variable "LD_PRELOAD" to set the first dynamic library to be preloaded when starting an application; when the application starts, the specified first dynamic library will be loaded into the memory address space of the process before the application is executed. The relevant code is as follows:

[0036] [Linux]LD_PRELOAD= / my / dir / injected.so. / a.out

[0037] By adopting the above method, it can be ensured that the target code in the first dynamic library (injected.so) is injected into the application before the application (a.out) is run.

[0038] Here, when the application is started, the execution subject may inject the first dynamic library into the application in various specific ways, such as inline injection, overlay injection, etc.

[0039] Among them, inline injection is used to indicate that the code is injected directly into the original code location, thereby "hijacking" the original code; overlay injection is used to indicate that the function pointer in the function jump table or symbol table is overwritten and redirected to the target function.

[0040] Here, the object of overlay injection can be the application itself or a library function that the application depends on.

[0041] Furthermore, the first dynamic library may provide various types of designated interfaces, such as application program interfaces, callback interfaces, etc., for calling.

[0042] Step 202: Load the second dynamic library into the application program in a plug-in manner.

[0043] In this embodiment, the execution entity can load the second dynamic library into the application in a plug-in manner, that is, load the second dynamic library, namely the plug-in dynamic library, and the plug-in interface function into the application. The loaded application can call the functions in the second dynamic library through the plug-in interface function.

[0044] Specifically, in the GNU Linux system, the second dynamic library can be loaded by the dl library in glibc. In the dl library, three library functions commonly used are dlopen (opening the dynamic library), dlclose (closing the dynamic library) and dlsym (searching for a well-known symbol from the symbol table of the dynamic library). Usually, the second dynamic library, i.e. the plug-in dynamic library, is loaded by dlopen, and the interface function with the pre-agreed interface name is found from the symbol table of the dynamic library by dlsym. After completing the loading of the second dynamic library and the plug-in interface function, the application can call the function in the plug-in dynamic library by the interface function. The second dynamic library, i.e. the plug-in dynamic library, can be unloaded by the dlclose function after use.

[0045] Step 203 : In response to the completion of injection of the first dynamic library and loading of the second dynamic library, based on the second dynamic library, a designated interface provided by the first dynamic library is called to control the functions provided by the first dynamic library.

[0046] In this embodiment, after determining that the injection of the first dynamic library is completed and the loading of the second dynamic library is completed, the execution entity can call the specified interface provided by the first dynamic library through the parameters in the second dynamic library, such as the API (Application Program Interface), to control all or part of the functions (for example, functions that are not enabled by default, functions that require calling the API to be triggered, etc.) in the first dynamic library injected into the application, that is, to control the application, that is, to combine the underlying functions corresponding to the first dynamic library with the application, and provide the application with controllable underlying function extensions.

[0047] Here, the functions provided by the first dynamic library are generally functions that the second dynamic library does not have.

[0048] In some optional methods, based on the second dynamic library, the specified interface provided by the first dynamic library is called to control the function provided by the first dynamic library, including: based on the second dynamic library, the specified interface provided by the first dynamic library is called to perform at least one of the following control operations on the function provided by the first dynamic library: underlying function switch, monitoring, auditing, optimized configuration, and automatic control.

[0049] In this implementation, the execution entity can call the specified interface provided by the first dynamic library through the parameters in the second dynamic library, and perform at least one of the following control operations on the function provided by the first dynamic library, that is, the injection part in the application: underlying function switch, monitoring, auditing, optimized configuration, and automatic control.

[0050] This implementation method calls the specified interface provided by the first dynamic library based on the second dynamic library, and performs at least one of the following control operations on the functions provided by the first dynamic library: underlying function switch, monitoring, auditing, optimized configuration, and automated control, thereby realizing the control of multiple underlying functions and the expansion of application functions.

[0051] In some optional embodiments, the method further includes: in response to determining that the second dynamic library is removed, disabling a new function in the first dynamic library that is opened or enabled by the second dynamic library.

[0052] In this implementation, some functions in the first dynamic library are not enabled by default. After these functions are enabled due to loading the second dynamic library, the execution entity can monitor the status of the second dynamic library in real time or periodically. If the second dynamic library is removed, such as uninstalling the second dynamic library, the new functions in the first dynamic library that are enabled or enabled due to the second dynamic library will be disabled.

[0053] This implementation achieves "pluggability" of the new function by disabling the new function in the first dynamic library that was opened or enabled by the second dynamic library in response to determining that the second dynamic library is removed.

[0054] In some optional embodiments, the method further includes: in response to determining that the application injected with the first dynamic library or the library function on which the application depends has changed, and the changed application or the library function on which the application depends is incompatible with the first dynamic library injection method, only re-adapting the first dynamic library.

[0055] In this implementation, if the code of the application's development library or the application itself changes, it needs to be recompiled, and the changed application's development library or application is incompatible with the injection method of the first dynamic library. At this time, the code of the first dynamic library must also be changed to adapt. Further, the adapted code is recompiled to ensure that the first dynamic library can still be used when the application itself or the dependent development library changes.

[0056] Specifically, when an application is updated from version 1.0 to version 2.0, the first dynamic library used on the original version 1.0 is no longer compatible with version 2.0. At this time, the source code of the first dynamic library needs to be modified to adapt to version 2.0. Only then can the modified first dynamic library be used on version 2.0.

[0057] Typically, the plug-in interface of the application and the designated interface provided by the first dynamic library will not change, and the second dynamic library does not need to be re-adapted.

[0058] This implementation method responds to determining that an application injected with the first dynamic library or a library function on which the application depends has changed, and that the changed application or the library function on which the application depends is incompatible with the first dynamic library injection method, by only re-adapting the first dynamic library, thereby achieving timely updating of the first dynamic library, thereby achieving timely and effective control of the first dynamic library, and isolating the impact of the application change on the plug-in.

[0059] In some optional methods, based on the second dynamic library, the specified interface provided by the first dynamic library is called to control the functions provided by the first dynamic library, including: based on the second dynamic library, the specified interface provided by the first dynamic library and the interface of the application itself are called to control the functions provided by the first dynamic library.

[0060] In this implementation, the execution entity can call the specified interface provided by the first dynamic library through the parameters in the second dynamic library, such as the API (Application Program Interface), and the interface of the application itself to control all or part of the functions (for example, functions that are not enabled by default, functions that require calling the API to be triggered, etc.) in the first dynamic library injected into the application.

[0061] This implementation method controls the functions provided by the first dynamic library by calling the specified interface provided by the first dynamic library and the interface of the application itself based on the second dynamic library. That is, it combines the underlying capabilities provided by the first dynamic library with the characteristics of the application itself, which helps to realize advanced capabilities such as operation and maintenance automation, that is, it helps to further expand the underlying capabilities of the application.

[0062] Continuing to refer to FIG3 , FIG3 is an architecture diagram of an application scenario of the application control method according to this embodiment.

[0063] In the application scenario of Figure 3, in the Linux system, the first dynamic library preloaded when starting the application can be set by specifying the environment variable "LD_PRELOAD"; when the application (such as a.out) is started, the specified first dynamic library (such as injected.so) will be loaded into the memory address space of the process before the execution of the application, so as to realize the injection of the object code in the first dynamic library into the application. Among them, the first dynamic library can provide a specified interface that can be called, for example, an API interface. Further, the second dynamic library (such as plugin.so) is loaded into the application in a plug-in manner, and the loaded application can call the function in the second dynamic library based on the plug-in interface function. In response to determining that the injection of the first dynamic library is completed and the loading of the second dynamic library is completed, the execution subject calls the specified interface provided by the first dynamic library (such as injected.so) based on the second dynamic library (plugin.so) to control the function provided by the first dynamic library, that is, to control the application.

[0064] FIG4a shows a process 400 of another embodiment of the application control method that can be applied to the present disclosure. In this embodiment, the application control method includes the following steps:

[0065] Step 401: inject the first dynamic library into the application by loading it at startup.

[0066] In this embodiment, the implementation details and technical effects of step 401 can be found in the description of step 201 and will not be repeated here.

[0067] Step 402: Load the second dynamic library into the application program in a plug-in manner.

[0068] In this embodiment, the implementation details and technical effects of step 402 can be found in the description of step 202 and will not be repeated here.

[0069] Step 403: Based on the plug-in level parameters provided by the second dynamic library, a designated interface provided by the first dynamic library is called to control the functions provided by the first dynamic library.

[0070] In this embodiment, the execution subject can call the corresponding designated interface provided by the first dynamic library through the plug-in level parameters provided by the second dynamic library to control the functions provided by the first dynamic library.

[0071] The plug-in level parameters include at least one of the following: configuration parameters and status parameters.

[0072] Specifically, MySQL supports plugin development through interfaces defined by its plugin system. However, MySQL's native memory management capabilities are relatively weak, and it lacks an interface for overriding its underlying memory allocator. Currently, MySQL's memory usage audit can only be tracked through memory-related instruments in the performance_schema (PFS), which manages system views related to MySQL performance monitoring. However, this relies on explicitly associating all code involving memory allocation and deallocation with a PFS instrument when coding the MySQL kernel. However, in reality, MySQL contains a large amount of memory allocation and deallocation code that is not associated with PFS, resulting in a significant discrepancy between PFS memory usage statistics and actual memory usage. Furthermore, MySQL compiled for the GNU Linux environment uses ptmalloc from the C standard library as its default memory allocator. However, ptmalloc's memory fragmentation recovery and return to the operating system are not very real-time. Consequently, in high-concurrency, high-load scenarios, excessive MySQL memory usage often leads to OOM (Out of Memory) errors.

[0073] The default memory allocator of the FreeBSD system, jemalloc, has the characteristics of relatively timely memory fragmentation recovery and return to the operating system. In addition, the aforementioned "LD_PRELOAD+dynamic library injection" method can be used to overwrite the malloc / free and other library functions of the MySQL memory allocator at startup to take over the memory allocation / recycling operations of MySQL. That is, the first dynamic library (jemalloc) is injected into the application by loading it at startup to alleviate the OOM phenomenon of MySQL.

[0074] In addition, jemalloc also provides a very rich API interface, which can implement functions such as real-time monitoring of memory allocation status (statistics APIs), memory allocation behavior auditing (profiling APIs, common scenarios include: memory leak analysis, memory occupancy analysis, etc.), and memory recovery (dirty / muzzy decay APIs). However, these functions are not enabled by default, or require calling APIs to trigger, and the dynamic library injection method is "transparent" to MySQL itself. The MySQL kernel cannot perceive and actively call jemalloc's interface. In addition, although jemalloc has the ability to actively reclaim memory and return it to the operating system, the triggering mechanism of memory recovery is still uncontrolled and cannot be managed through MySQL's own interface. Therefore, even if jemalloc is used, MySQL still has a certain probability of generating OOM due to the untimely triggering of the memory recovery mechanism.

[0075] To address these issues, we developed a plugin called my_jemalloc based on the MySQL plugin interface. The plugin's output is the dynamic library "my_jemalloc.so," a second dynamic library. The MySQL plugin is named "jemalloc." This second dynamic library and the plugin interface functions are loaded into the application. Leveraging the MySQL plugin interface, we provide a series of plugin-level parameters that enable memory allocator monitoring and other advanced features.

[0076] The MySQL plugin supports two types of parameters. One type is called "system variables," named "plugin name (lowercase)_parameter name." These are configuration parameters and are read-write. The other type is called "status variables," named "plugin name (uppercase)_parameter name." These are read-only parameters for status monitoring (statistics). The my_jemalloc plugin provides the following parameters:

[0077] Jemalloc's memory allocation status monitoring parameters (status parameters) are named "Jemalloc_stats_xxx" and display the memory allocation status by calling jemalloc's statistics APIs.

[0078] The memory reclamation trigger parameter (system parameter) is named "jemalloc_manually_reclaim". When reading this parameter, the total amount of reclaimable physical memory is counted by accessing the jemalloc statistics APIs. When writing any value to this parameter, the jemalloc dirty / muzzy decay APIs are called to implement the aging reclamation of free memory pages.

[0079] The memory profiling switch parameter (system parameter) is named "jemalloc_active_profiling." Jemalloc supports logging of memory allocation and deallocation activities, but this behavior has a significant impact on performance and consumes additional memory. Therefore, the my_jemalloc plugin does not enable this feature by default. Users can enable it manually if they need to perform memory analysis.

[0080] The memory log write parameter (system parameter, write-only), named "jemalloc_dump_profiling", is only available when memory profiling is enabled. By entering a writable profile file path into this parameter, the entire contents of the current jemalloc memory log will be dumped to this file.

[0081] The background memory reclaim thread switch parameter (system parameter), named "jemalloc_monitor_switch", is used to start or stop the automatic memory reclaim thread. The Jemalloc library itself provides a background memory reclaim thread, but the Jemalloc plugin introduces its own background thread to implement the automatic memory reclamation strategy. It performs memory reclaim by explicitly calling the dirty / muzzy decay interface.

[0082] The polling interval parameter (system parameter) for the background memory recycling thread is named "jemalloc_monitor_interval". After the background thread is started, it will periodically poll according to the number of seconds set by this parameter to monitor whether the automatic memory recycling action is performed.

[0083] The memory high water mark parameter (system parameter) is named "jemalloc_high_water_mark". After the background thread is started, when the memory usage of the current MySQL instance reaches or exceeds the specified value, memory reclamation action is automatically triggered (that is, dirty / muzzy decay APIs are called).

[0084] This approach, on the one hand, enables controllable and observable memory management capabilities. Specifically, users can accurately monitor MySQL's memory usage by querying parameters such as Jemalloc_stats_xxx in the plugin. Furthermore, by using profiling-related parameters, they can conduct more precise analysis of MySQL's memory allocation and deallocation behavior. This expands MySQL's controllable memory observability capabilities, far surpassing its native PFS capabilities.

[0085] Furthermore, by managing relevant parameters through background threads, we can configure and enable automatic memory reclamation policies. Furthermore, by triggering parameters for memory reclamation behavior, we can also implement memory reclamation driven by human intervention. In other words, the my_jemalloc plugin extends MySQL with two sets of memory reclamation policies: automatic and manual. This ensures that memory usage always remains below a certain expected level, completely resolving the Out-of-Memory (OOM) problem. The detailed process of the background memory reclamation thread is shown in Figure 4b.

[0086] In addition, the my_jemalloc plugin is pluggable. When the plugin is uninstalled, its advanced features are automatically disabled. Figure 4c shows the plugin uninstallation process.

[0087] As can be seen from Figure 4, compared with the embodiment corresponding to Figure 2, the process 400 of the application control method in this embodiment reflects that in response to the completion of the injection of the first dynamic library and the completion of the loading of the second dynamic library, based on the plug-in level parameters provided by the second dynamic library, the specified interface provided by the first dynamic library is called to control the functions provided by the first dynamic library. The plug-in level parameters include at least one of the following: status parameters, configuration parameters, which further realize the refined control and expansion of the underlying functions of the application.

[0088] With further reference to FIG5 , as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an application control device. This device embodiment corresponds to the method embodiment shown in FIG2 , and the device can be specifically applied to various electronic devices.

[0089] As shown in FIG5 , the application control device 500 of this embodiment includes an injection module 501 , a loading module 502 , and a control module 503 .

[0090] The injection module 501 may be configured to inject the first dynamic library into the application by loading it at startup.

[0091] The loading module 502 may be configured to load the second dynamic library into the application program in a plug-in manner.

[0092] The control module 503 may be configured to, in response to determining that the injection of the first dynamic library is completed and the loading of the second dynamic library is completed, call a specified interface provided by the first dynamic library based on the second dynamic library to control the functions provided by the first dynamic library.

[0093] In some optional aspects of this embodiment, the control module is further configured to call a specified interface provided by the first dynamic library based on the plug-in level parameters provided by the second dynamic library to control the functions provided by the first dynamic library.

[0094] In some optional aspects of this embodiment, the control module is further configured to call a specified interface provided by the first dynamic library and an interface of the application program itself based on the second dynamic library to control the functions provided by the first dynamic library.

[0095] In some optional aspects of this embodiment, the device further includes: a closing module configured to close the new function in the first dynamic library that was opened or enabled by the second dynamic library in response to determining that the second dynamic library is removed.

[0096] In some optional embodiments of this embodiment, the control module is further configured to: based on the second dynamic library, call the specified interface provided by the first dynamic library, and perform at least one of the following control operations on the function provided by the first dynamic library: underlying function switch, monitoring, auditing, optimized configuration, and automated control.

[0097] In some optional embodiments of this embodiment, the device also includes: a change module, which is configured to only re-adapt the first dynamic library in response to determining that the application injected by the first dynamic library or the library function on which the application depends has changed, and the changed application or the library function on which the application depends is incompatible with the first dynamic library injection method.

[0098] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0099] FIG6 is a block diagram of an electronic device according to an application control method according to an embodiment of the present disclosure.

[0100] 600 is a block diagram of an electronic device according to an application control method according to an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0101] As shown in Figure 6, the electronic device includes: one or more processors 601, a memory 602, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). In Figure 6, a processor 601 is taken as an example.

[0102] Memory 602 is a non-transitory computer-readable storage medium provided in the present disclosure. The memory stores instructions executable by at least one processor, causing the at least one processor to perform the application control method provided in the present disclosure. The non-transitory computer-readable storage medium of the present disclosure stores computer instructions for causing a computer to perform the application control method provided in the present disclosure.

[0103] Memory 602, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as the program instructions / modules corresponding to the application control method in the embodiments of the present disclosure (e.g., injection module 501, loading module 502, and control module 503 shown in FIG. 5 ). Processor 601 executes the non-transitory software programs, instructions, and modules stored in memory 602 to execute various functional applications and data processing of the server, thereby implementing the application control method in the above-mentioned method embodiment.

[0104] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created by the use of the electronic device controlled by the application, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 602 may optionally include a memory remotely located relative to the processor 601, and these remote memories may be connected to the electronic device controlled by the application via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0105] The electronic device of the application control method may further include an input device 603 and an output device 604. The processor 601, the memory 602, the input device 603 and the output device 604 may be connected via a bus or other means, and FIG6 takes the bus connection as an example.

[0106] The input device 603 can receive input digital or character information, such as an input device such as a touch screen, a keypad, a mouse, a trackpad, a touch pad, a pointer, one or more mouse buttons, a trackball, a joystick, etc. The output device 604 can include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The display device can include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some embodiments, the display device can be a touch screen.

[0107] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0108] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for a programmable processor and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., a magnetic disk, an optical disk, a memory, a programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0109] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0110] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0111] Computer systems may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The client and server relationship arises through computer programs running on the respective computers and having a client-server relationship to each other.

[0112] According to the technical solution of the embodiment of the present disclosure, the first dynamic library is injected into the application by loading it at startup; the second dynamic library is loaded into the application as a plug-in; in response to determining that the injection of the first dynamic library is completed and the loading of the second dynamic library is completed, based on the second dynamic library, the specified interface provided by the first dynamic library is called to control the functions provided by the first dynamic library, that is, by simultaneously loading the injected first dynamic library and the plug-in second dynamic library, the control and expansion of the underlying functions of the application are achieved.

[0113] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not a limitation herein.

[0114] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. An application control method, the method comprising: Inject the first dynamic library into the application by loading it at startup; Loading the second dynamic library into the application program in a plug-in manner; In response to determining that the injection of the first dynamic library is completed and the loading of the second dynamic library is completed, based on the second dynamic library, a designated interface provided by the first dynamic library is called to control the function provided by the first dynamic library.

2. The method according to claim 1, wherein: The calling, based on the second dynamic library, a specified interface provided by the first dynamic library to control the function provided by the first dynamic library includes: Based on the plug-in level parameters provided by the second dynamic library, the specified interface provided by the first dynamic library is called to control the functions provided by the first dynamic library, wherein the plug-in level parameters include at least one of the following: configuration parameters and state parameters.

3. The method according to claim 1, wherein: The calling, based on the second dynamic library, a specified interface provided by the first dynamic library to control the function provided by the first dynamic library includes: Based on the second dynamic library, the specified interface provided by the first dynamic library and the interface of the application program itself are called to control the functions provided by the first dynamic library.

4. The method according to claim 1, wherein: The calling, based on the second dynamic library, a specified interface provided by the first dynamic library to control the function provided by the first dynamic library includes: Based on the second dynamic library, the specified interface provided by the first dynamic library is called to perform at least one of the following control operations on the function provided by the first dynamic library: underlying function switch, monitoring, auditing, optimized configuration, and automatic control.

5. The method according to any one of claims 1 to 4, further comprising: In response to determining that the second dynamic library is removed, a new function in the first dynamic library opened or enabled by the second dynamic library is disabled.

6. The method according to any one of claims 1 to 4, further comprising: In response to determining that the application injected by the first dynamic library or the library function on which the application depends has changed, and the changed application or the library function on which the application depends is incompatible with the first dynamic library injection method, only the first dynamic library is re-adapted.

7. An application control device, the device comprising: An injection module is configured to inject the first dynamic library into the application program by loading it at startup; A loading module configured to load the second dynamic library into the application in a plug-in manner; The control module is configured to, in response to determining that the injection of the first dynamic library is completed and the loading of the second dynamic library is completed, call a specified interface provided by the first dynamic library based on the second dynamic library to control the function provided by the first dynamic library.

8. The device according to claim 7, wherein: The control module is further configured to: Based on the plug-in level parameters provided by the second dynamic library, the specified interface provided by the first dynamic library is called to control the functions provided by the first dynamic library, wherein the plug-in level parameters include at least one of the following: configuration parameters and state parameters.

9. The device according to claim 7, wherein: The control module is further configured to: Based on the second dynamic library, the specified interface provided by the first dynamic library and the interface of the application program itself are called to control the functions provided by the first dynamic library.

10. The device according to claim 7, wherein: The control module is further configured to: based on the second dynamic library, call the specified interface provided by the first dynamic library, and perform at least one of the following control operations on the function provided by the first dynamic library: underlying function switch, monitoring, auditing, optimized configuration, and automatic control.

11. The device according to any one of claims 7 to 9, wherein: The device also includes: The closing module is configured to close the new function in the first dynamic library opened or enabled by the second dynamic library in response to determining that the second dynamic library is removed.

12. The device according to any one of claims 7 to 9, wherein: The device also includes: The change module is configured to re-adapt only the first dynamic library in response to determining that the application injected by the first dynamic library or the library function on which the application depends has changed, and the changed application or the library function on which the application depends is incompatible with the first dynamic library injection method.

13. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 6.

14. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method, device and system for extending functions of application program and medium

    CN111142972A

  • Method for generating and testing internal test program of application program

    CN113553271A

  • Dynamic library loading and compiling method and device, terminal and storage medium

    CN114237742A

  • Code processing method and device, equipment and storage medium

    CN114327481A

  • SDK (Software Development Kit) loading method and device, equipment and storage medium

    CN115934198A