Method and related device for realizing cross-digit calling of dynamic link library
By creating an N-bit auxiliary process in the M-bit dynamic link library, the communication and interface calling between the M-bit program and the N-bit dynamic link library are realized, which solves the problem of calling the dynamic link library across multiple digits and realizes the cross-bit compatibility of the program. performance and functionality expansion.
Patent Information
- Application Number
- CN202411035290.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-18
AI Technical Summary
Existing technology cannot realize cross-bit calling of dynamic link libraries, resulting in 64-bit computer programs being unable to call 32-bit dynamic link libraries, and 32-bit computer programs being unable to call 64-bit dynamic link libraries, which limits the function expansion and compatibility of programs.
By creating an N-bit auxiliary process in the M-bit dynamic link library, communication and interface calls between the M-bit program and the N-bit dynamic link library are realized. The M-bit dynamic link library notifies the N-bit auxiliary process to load and execute functions in the target dynamic link library. , complete the cross-digit call.
It has been realized that the M-bit program can call the N-bit dynamic link library in the same way as the M-bit dynamic link library. The calling code of the original N-bit dynamic link library hardly needs to be modified. The N-bit auxiliary process is automatically controlled by the M-bit dynamic link library. Maintenance, avoiding additional maintenance work.
Smart Images

Figure CN118796312A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer programming, and in particular to a method and related device for implementing cross-bit number calling of a dynamic link library. Background Art
[0002] A dynamic link library is a compiled code segment. A computer program can call the dynamic link library at runtime to run the functions in the dynamic link library.
[0003] Computer programs have different bit numbers, for example, there are 32-bit computer programs and 64-bit computer programs. Like computer programs, dynamic link libraries also have different bit numbers, for example, there are 32-bit dynamic link libraries and 64-bit dynamic link libraries. When a computer program calls a dynamic link library, it can only call a dynamic link library with the same bit number, and cannot call a dynamic link library with different bit numbers. For example, a 32-bit computer program can only call a 32-bit dynamic link library, and cannot call a 64-bit dynamic link library. A 64-bit computer program can only call a 64-bit dynamic link library, and cannot call a 32-bit dynamic link library.
[0004] However, in actual scenarios, it may be necessary to call dynamic link libraries across bit numbers. For example, a 64-bit computer program may need to call a 32-bit dynamic link library, and a 32-bit computer program may also need to call a 64-bit dynamic link library. How to implement the cross-bit number calling of dynamic link libraries is a problem that needs to be solved urgently. Summary of the invention
[0005] In view of this, the present application provides a method and a related device for implementing cross-bit number calling of dynamic link libraries, which are used to implement cross-bit number calling of dynamic link libraries. The technical solution is as follows:
[0006] The first aspect of the present application provides a method for implementing a cross-bit number calling dynamic link library, comprising:
[0007] The M-bit program loads a pre-established M-bit dynamic link library, the M-bit dynamic link library creates an N-bit auxiliary process, wherein the M-bit dynamic link library has the same interface as a plurality of N-bit dynamic link libraries, M and N are both positive integer powers of 2, and M is different from N;
[0008] The M-bit program notifies the M-bit dynamic link library to load a target dynamic link library, the M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library, the N-bit auxiliary process loads the target dynamic link library, and feeds back a loading result of the target dynamic link library to the M-bit dynamic link library, wherein the target dynamic link library is a dynamic link library among the plurality of N-bit dynamic link libraries;
[0009] If the target dynamic link library is loaded successfully, the M-bit program calls the target interface in the M-bit dynamic link library, the M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function in the target dynamic link library that implements the target interface, the N-bit auxiliary process executes the target function in the target dynamic link library and feeds back the execution result of the target function to the M-bit dynamic link library, wherein the target interface is an interface of the target dynamic link library.
[0010] In a possible implementation, the M-bit dynamic link library has a loading function and an unloading function, the loading function has a code for detecting whether there is an N-bit auxiliary process and creating an N-bit auxiliary process, and the unloading function has a code for terminating the N-bit auxiliary process;
[0011] The M-bit dynamic link library creates an N-bit auxiliary process, including:
[0012] The loading function in the M-bit dynamic link library detects whether there is an N-bit auxiliary process;
[0013] If the N-bit auxiliary process does not exist, the loading function in the M-bit dynamic link library creates the N-bit auxiliary process;
[0014] If there are N-bit auxiliary processes, the unloading function in the M-bit dynamic link library terminates the N-bit auxiliary processes, and the loading function in the M-bit dynamic link library recreates the N-bit auxiliary processes.
[0015] In a possible implementation, the M-bit program notifies the M-bit dynamic link library to load a target dynamic link library, including:
[0016] The M-bit program calls a loading function in the M-bit dynamic link library to load a target dynamic link library.
[0017] In a possible implementation, the method for implementing cross-bit number calling of a dynamic link library further includes:
[0018] After the M-bit dynamic link library creates the N-bit auxiliary process, the N-bit auxiliary process establishes a shared memory, and the M-bit dynamic link library communicates with the N-bit auxiliary process through the shared memory.
[0019] In a possible implementation, the M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library, including:
[0020] The M-bit dynamic link library writes the name of the target dynamic link library into the shared memory, and notifies the N-bit auxiliary process to read the information in the shared memory;
[0021] The N-bit auxiliary process loads the target dynamic link library and feeds back the loading result of the target dynamic link library to the M-bit dynamic link library, including:
[0022] The N-bit auxiliary process reads the name of the target dynamic link library in the shared memory, loads the target dynamic link library according to the read name, writes the loading result of the target dynamic link library into the shared memory, and notifies the M-bit dynamic link library to read the loading result of the target dynamic link library from the shared memory.
[0023] In a possible implementation, the M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function implementing the target interface in the target dynamic link library, including:
[0024] The M-bit dynamic link library writes the function call information of the target function into the shared memory, and notifies the N-bit auxiliary process to read the information in the shared memory;
[0025] The N-bit auxiliary process executes the target function in the target dynamic link library and feeds back the execution result of the target function to the M-bit dynamic link library, including:
[0026] The N-bit auxiliary process reads the function call information in the shared memory, executes the target function in the target dynamic link library according to the read function call information, writes the execution result of the target function into the shared memory, and notifies the M-bit dynamic link library to read the execution result of the target function from the shared memory.
[0027] In a possible implementation, the method for implementing cross-bit number calling of a dynamic link library further includes:
[0028] The M-bit program unloads the M-bit dynamic link library, and the M-bit dynamic link library terminates the N-bit auxiliary process.
[0029] A second aspect of the present application provides a device for implementing cross-bit number calling of a dynamic link library, comprising: an M-bit program driving module, an M-bit dynamic link library driving module, and an N-bit auxiliary process driving module;
[0030] The M-bit program driving module is used to drive the M-bit program to load a pre-established M-bit dynamic link library, wherein the M-bit dynamic link library has the same interface as a plurality of N-bit dynamic link libraries, M and N are both positive integer powers of 2, and M is different from N;
[0031] The M-bit dynamic link library driving module is used to drive the M-bit dynamic link library to create an N-bit auxiliary process;
[0032] The M-bit program driving module is further used to drive the M-bit program to notify the M-bit dynamic link library to load a target dynamic link library, wherein the target dynamic link library is a dynamic link library among the plurality of N-bit dynamic link libraries;
[0033] The M-bit dynamic link library driving module is further used to drive the M-bit dynamic link library to notify the N-bit auxiliary process to load the target dynamic link library;
[0034] The N-bit auxiliary process driving module is used to drive the N-bit auxiliary process to load the target dynamic link library, and feed back the loading result of the target dynamic link library to the M-bit dynamic link library;
[0035] The M-bit program driving module is further used to drive the M-bit program to call a target interface in the M-bit dynamic link library when the target dynamic link library is loaded successfully, wherein the target interface is an interface of the target dynamic link library;
[0036] The M-bit dynamic link library driving module is used to drive the M-bit dynamic link library to notify the N-bit auxiliary process to execute the target function of the target dynamic link library that implements the target interface;
[0037] The N-bit auxiliary process driving module is also used to drive the N-bit auxiliary process to execute the target function in the target dynamic link library, and feed back the execution result of the target function to the M-bit dynamic link library.
[0038] A third aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0039] The memory is used to store computer programs;
[0040] The processor is used to execute the computer program so that the electronic device can implement any one of the steps of the method for implementing cross-bit number calling of dynamic link libraries described above.
[0041] A fourth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any one of the steps of the method for implementing cross-bit number calling of a dynamic link library as described above.
[0042] By means of the above technical scheme, the present application provides a method for implementing cross-bit number calling of dynamic link libraries, pre-establishing an M-bit dynamic link library with the same interface as several N-bit dynamic link libraries, and when making a dynamic link library call, the M-bit program first loads the pre-established M-bit dynamic link library, and when the M-bit program loads the M-bit dynamic link library, the M-bit dynamic link library creates an N-bit auxiliary process, and then the M-bit program notifies the M-bit dynamic link library to load the target dynamic link library (N-bit dynamic link library), the M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library, and after the N-bit auxiliary process completes loading the target dynamic link library, the loading result of the target dynamic link library is fed back to the M-bit dynamic link library, and if the target dynamic link library is loaded successfully, the M-bit program calls the target interface (the interface of the target dynamic link library) in the M-bit dynamic link library, the M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function that implements the target interface in the target dynamic link library, and after the N-bit auxiliary process executes the target function, the execution result of the target function is fed back to the M-bit dynamic link library. The method for implementing cross-bit number calling of dynamic link libraries provided in the present application realizes the calling of N-bit dynamic link libraries by M-bit programs by introducing M-bit dynamic link libraries and N-bit auxiliary processes. The introduction of M-bit dynamic link libraries and N-bit auxiliary processes enables the M-bit program to call the N-bit dynamic link library in a manner that is almost completely consistent with calling the M-bit dynamic link library. The calling code of the original N-bit dynamic link library hardly needs to be changed. In addition, the N-bit auxiliary process is automatically maintained by the M-bit dynamic link library, and no special additional maintenance is required. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0044] Figure 1 A schematic diagram of a hardware structure of a terminal provided in an embodiment of the present application;
[0045] Figure 2 A flowchart of a method for implementing a cross-bit number calling dynamic link library provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of implementing an M-bit program calling an N-bit dynamic link library by introducing an M-bit dynamic link library and an N-bit auxiliary process provided in an embodiment of the present application;
[0047] Figure 4 A schematic diagram of a management mechanism for N auxiliary processes provided in an embodiment of the present application;
[0048] Figure 5 A flowchart of a method for implementing a 64-bit program calling a 32-bit dynamic link library provided in an embodiment of the present application;
[0049] Figure 6 A schematic diagram of the structure of an apparatus for implementing cross-bit number calling of a dynamic link library provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0051] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0052] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0053] The method for calling a dynamic link library across bit numbers provided in the present application can be applied to a terminal, which may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiments of the present application do not impose any restrictions on this.
[0054] Figure 1 An optional hardware structure diagram of a terminal is shown.
[0055] refer to Figure 1As shown, the terminal may include a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), an earphone jack 163 (optional), a processor 170, an external interface 180, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 1 This is merely an example of a terminal and does not constitute a limitation on the terminal. The terminal may include more or fewer components than shown in the figure, or a combination of certain components, or different components.
[0056] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the terminal. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0057] The display unit 140 may be used to display information input by a user or information provided to a user, various menus of the terminal, an interactive interface, file display, and / or playback of any multimedia file.
[0058] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.
[0059] The processor 170 is the control center of the terminal. It uses various interfaces and lines to connect various parts of the entire terminal. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.
[0060] Among them, the memory 120 can be used to store software codes related to the method of calling dynamic link libraries across bit numbers. The processor 170 can call the software codes stored in the memory 120, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to implement corresponding functions.
[0061] The radio frequency unit 110 (optional) can be used to receive and send information or receive and send signals during a call. For example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent to the base station. Generally, the radio frequency unit 110 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LowNoiseAmplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General PacketRadio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.
[0062] In the embodiment of the present application, the radio frequency unit 110 can send data to other devices, and can also receive data sent by other devices. It should be understood that the radio frequency unit 110 is optional, and can be replaced by other communication interfaces, such as a network port.
[0063] The terminal also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions.
[0064] The terminal also includes an external interface 180, which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal to communicate with other devices, or to connect a charger to charge the terminal.
[0065] Although not shown, the terminal may further include a flashlight, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which will not be described in detail here.
[0066] It should be understood that the processor 170 in the above-mentioned terminal can be a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0067] In order to realize the cross-bit number calling of dynamic link library, the inventor of this case conducted research. The initial idea was: recompile the N-bit (for example, 32-bit) dynamic link library into an M-bit (for example, 64-bit) dynamic link, and then, the M-bit (for example, 64-bit) program can call the recompiled M-bit (for example, 64-bit) dynamic link.
[0068] The inventors of this case studied the above ideas and found that the above ideas have certain limitations, which are specifically reflected in that the source code of the N-bit (for example, 32-bit) dynamic link library must be available. If there is no source code of the N-bit (for example, 32-bit) dynamic link library, recompilation will be impossible.
[0069] In view of the defects of the above-mentioned ideas, the inventor of this case continued to conduct research and came up with a solution of realizing cross-bit-size calling of dynamic link libraries based on auxiliary processes. The overall idea of this solution is to establish an N-bit (for example, 32-bit) auxiliary process, which directly calls the N-bit (for example, 32-bit) dynamic link library, and the M-bit (for example, 64-bit) program communicates with the N-bit (for example, 32-bit) auxiliary process, that is, the M-bit (for example, 64-bit) program completes the call to the N-bit (for example, 32-bit) dynamic link library with the assistance of the N-bit (for example, 32-bit) auxiliary process.
[0070] The inventors of this case studied the solution of implementing cross-bit number calling of dynamic link libraries based on auxiliary processes and found that although this solution does not require the source code of N-bit (for example, 32-bit) dynamic link libraries, it brings new problems: First, since the M-bit (for example, 64-bit) program needs to communicate with the N-bit (for example, 32-bit) auxiliary process, the code changes are large compared to directly calling the dynamic link of the same bit number; second, it is necessary to additionally maintain the N-bit auxiliary process.
[0071] In response to the problems existing in the above-mentioned solution based on auxiliary process to realize cross-bit number calling of dynamic link library, the inventor of this case conducted further research and finally proposed a method for realizing cross-bit number calling of dynamic link library through continuous research. This solution can realize cross-bit number calling of dynamic link library and overcome the defects of the above two solutions.
[0072] Next, the method for implementing cross-bit number calling of dynamic link library provided by the present application is introduced through the following embodiments.
[0073] See also Figure 2 , shows a schematic flow chart of a method for implementing a cross-bit number calling dynamic link library provided by an embodiment of the present application, and the method for implementing a cross-bit number calling dynamic link library may include:
[0074] Step S201: an M-bit program loads a pre-established M-bit dynamic link library.
[0075] In this embodiment, an M-bit dynamic link library is pre-established, and the M-bit dynamic link library has the same interface as a plurality of N-bit dynamic link libraries.
[0076] Among them, M and N are both positive integer powers of 2, and M is different from N. For example, M is 64 and N is 32. For another example, M is 32 and N is 64.
[0077] Assuming that M is 64 and N is 32, that is, a 64-bit program needs to call a 32-bit dynamic link library, a 64-bit dynamic link library is pre-established. The 64-bit dynamic link library has the same interface as the 32-bit dynamic link library. The following table shows an example of the interface of the 64-bit dynamic link library.
[0078] Table 1 An example of the interface of a 64-bit dynamic link library
[0079] interface Function LoadDLL() Load a 32-bit dynamic link library RemoveDLL() Uninstall a 32-bit dynamic link library Interface a1 in 32-bit dynamic link library A Implement the interface and communicate with the 32-bit auxiliary process, calling function a1 in dynamic link library A Interface b1 in 32-bit dynamic link library B Implement the interface and communicate with the 32-bit auxiliary process, calling function b1 in dynamic link library B Interface b2 in 32-bit dynamic link library B Implement the interface and communicate with the 32-bit auxiliary process, calling function b2 in dynamic link library B Interface c1 in 32-bit dynamic library C Implement the interface and communicate with the 32-bit auxiliary process, calling function c1 in the dynamic link library C … …
[0080] It can be seen from Table 1 that the 64-bit dynamic link library has multiple interfaces that the 32-bit dynamic link library has, such as interface a1 in 32-bit dynamic link library A, interface b1 in 32-bit dynamic link library B, etc. It should be noted that interface a1 in Table 1 only contains the function declaration of function a1 in dynamic link library A, and does not have the specific implementation code of function a1, and the same is true for interfaces such as interface b2 and interface c1.
[0081] Step S202: The M-bit dynamic link library creates the N-bit auxiliary process.
[0082] In this embodiment, when the M-bit dynamic link library is loaded by the M-bit program, the M-bit dynamic link library automatically creates an auxiliary process.
[0083] The M-bit dynamic link library has a loading function (such as LoadDLL() in the above table) and an unloading function (such as RemoveDLL() in the above table). In one possible implementation, the loading function can be set with codes for detecting whether there are N-bit auxiliary processes and for creating N-bit auxiliary processes, and the unloading function can be set with codes for terminating the N-bit auxiliary processes.
[0084] When an M-bit program loads an M-bit dynamic link library, the loading function in the M-bit dynamic link library can detect whether there is an N-bit auxiliary process. If there is no N-bit auxiliary process, the loading function in the M-bit dynamic link library will create the N-bit auxiliary process. If there is an N-bit auxiliary process, in one possible implementation, the N-bit auxiliary process can be directly used to perform subsequent operations. However, considering that the N-bit auxiliary process may be abnormal for some reason, in order to ensure the successful call to the dynamic link library, in another possible implementation, the unloading function in the M-bit dynamic link library can first terminate the currently existing N-bit auxiliary process, and then the loading function in the M-bit dynamic link library will re-create the N-bit auxiliary process. In this way, each time the M-bit dynamic link library is loaded, there will be a new, normal N-bit auxiliary process to handle the communication request.
[0085] Step S203: the M-bit program notifies the M-bit dynamic link library to load the target dynamic link library.
[0086] Specifically, the M-bit program calls the loading function (LoadDLL()) in the M-bit dynamic link library to load the target dynamic link library.
[0087] The target dynamic link library is a dynamic link library among a plurality of N-bit dynamic link libraries.
[0088] Exemplarily, several N-bit dynamic link libraries include N-bit dynamic link library A, N-bit dynamic link library B, and N-bit dynamic link library C. Assuming that an M-bit program wants to call a function in N-bit dynamic link library A, the M-bit dynamic link library is first notified to load N-bit dynamic link library A. Specifically, the M-bit program calls the loading function (LoadDLL()) in the M-bit dynamic link library to load N-bit dynamic link library A.
[0089] Step S204: the M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library.
[0090] When the M-bit program calls the loading function in the M-bit dynamic link library to load the target dynamic link library, the M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library.
[0091] Step S205: the N-bit auxiliary process loads the target dynamic link library, and feeds back the loading result of the target dynamic link library to the M-bit dynamic link library.
[0092] Since both the auxiliary process and the target dynamic link library are N bits, the N-bit auxiliary process can directly load the target dynamic link library. After the N-bit auxiliary process loads the target dynamic link library, it feeds back the loading result of the target dynamic link library to the M-bit dynamic link library. The loading result of the target dynamic link library is used to indicate whether the target dynamic link library is loaded successfully.
[0093] It should be noted that after the M-bit program loads the M-bit dynamic link library, the M-bit dynamic link library becomes a part of the M-bit program. Therefore, feeding back the loading result of the target dynamic link library to the M-bit dynamic link library is equivalent to feeding back the loading result of the target dynamic link library to the M-bit program.
[0094] Step S206: If the target dynamic link library is loaded successfully, the M-bit program calls the target interface in the M-bit dynamic link library.
[0095] After the M-bit program learns that the target dynamic link library has been loaded successfully based on the loading result of the target dynamic link library fed back by the N-bit auxiliary process, it can call the target interface in the M-bit dynamic link library.
[0096] As mentioned above, an M-bit dynamic link library has the same interface as several N-bit dynamic link libraries. In this step, the "target interface in the M-bit dynamic link library" is an interface of the target dynamic link library.
[0097] Step S207: the M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function that implements the target interface in the target dynamic link library.
[0098] When an M-bit program calls a target interface in an M-bit dynamic link library, the M-bit dynamic link library notifies an N-bit auxiliary process to execute a target function that implements the target interface in the target dynamic link library.
[0099] For example, if an M-bit program wants to call function a1 in an N-bit dynamic link library A, it will call the interface of the same name in the M-bit dynamic link library, that is, it will call interface a1 in the M-bit dynamic link library. When the M-bit program calls interface a1 in the dynamic link library, the M-bit dynamic link library will notify the N-bit auxiliary process to execute function a1 in the N-bit dynamic link library A.
[0100] Step S208: the N-bit auxiliary process executes the target function in the target dynamic link library, and feeds back the execution result of the target function to the M-bit dynamic link library.
[0101] After the M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function that implements the target interface in the target dynamic link library, the N-bit auxiliary process will execute the target function in the target dynamic link library. After executing the target function in the target dynamic link library, the execution result of the target function will be fed back to the M-bit dynamic link library.
[0102] The above content mentioned that after the M-bit program loads the M-bit dynamic link library, the M-bit dynamic link library becomes a part of the M-bit program. Therefore, the N-bit auxiliary process feeds back the execution result of the target function to the M-bit dynamic link library, which is equivalent to feeding back the execution result of the target function to the M-bit program.
[0103] Through the above process, it can be known that the method for implementing cross-bit number calling of dynamic link libraries provided by the present application, by introducing an M-bit dynamic link library and an N-bit auxiliary process, implements the calling of an M-bit program to an N-bit dynamic link library, such as Figure 3 As shown, the M-bit dynamic link library is directly called by the M-bit program. Since the M-bit dynamic link library has the same interface as the N-bit dynamic link library, when the M-bit dynamic link library is called by the M-bit program, the M-bit dynamic link library can communicate with the N-bit auxiliary process and complete the call to the N-bit dynamic link library with the assistance of the N-bit auxiliary process.
[0104] It should be noted that this application manages N-bit auxiliary processes through M-bit dynamic link libraries (i.e., the M-bit dynamic link library automatically maintains the life cycle of N-bit auxiliary processes). N-bit auxiliary processes are created when the M-bit dynamic link library is loaded and terminated when the M-bit dynamic link library is unloaded. Figure 4 , which shows a schematic diagram of the management mechanism for N auxiliary processes.
[0105] The method for implementing cross-bit number calling of dynamic link libraries provided in the embodiment of the present application pre-establishes an M-bit dynamic link library with the same interface as several N-bit dynamic link libraries. When calling the dynamic link library, the M-bit program first loads the pre-established M-bit dynamic link library. When the M-bit program loads the M-bit dynamic link library, the M-bit dynamic link library creates an N-bit auxiliary process. Then, the M-bit program notifies the M-bit dynamic link library to load the target dynamic link library. The M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library. After the N-bit auxiliary process loads the target dynamic link library, the loading result of the target dynamic link library is fed back to the M-bit dynamic link library. If the target dynamic link library is loaded successfully, the M-bit program calls the target interface in the M-bit dynamic link library. The M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function that implements the target interface in the target dynamic link library. After the N-bit auxiliary process executes the target function in the target dynamic link library, the execution result of the target function is fed back to the M-bit dynamic link library. The method for implementing cross-bit number calling of dynamic link libraries provided in the embodiment of the present application implements the calling of N-bit dynamic link libraries by M-bit programs by introducing M-bit dynamic link libraries and N-bit auxiliary processes. The introduction of M-bit dynamic link libraries and N-bit auxiliary processes enables the M-bit program to call the N-bit dynamic link library in a manner that is almost completely consistent with the calling of the M-bit dynamic link library. The original calling code of the N-bit dynamic link library hardly needs to be changed. In addition, the N-bit auxiliary process is automatically maintained by the M-bit dynamic link library, and no additional maintenance is required for the M-bit program.
[0106] The above-mentioned embodiments mentioned that the method for implementing cross-bit number calling of dynamic link libraries provided in the present application realizes the calling of N-bit dynamic link libraries by M-bit programs by introducing M-bit dynamic link libraries and N-bit auxiliary processes. It can be seen from the implementation process provided by the above-mentioned embodiments that in the process of implementing the M-bit program calling the N-bit dynamic link library, the M-bit dynamic link library needs to communicate with the N-bit auxiliary process, and the N-bit auxiliary process also needs to communicate with the M-bit dynamic link library. In one possible implementation method, the communication between the M-bit dynamic link library and the N-bit auxiliary process can be implemented based on shared memory.
[0107] In a possible implementation, after the M-bit dynamic link library creates the N-bit auxiliary process, the N-bit auxiliary process may establish a shared memory for communicating with the M-bit dynamic link library.
[0108] Next, step S204, step S205, step S207, and step S208 in the above embodiment involving communication between the M-bit dynamic link library and the N-bit auxiliary process are further introduced.
[0109] The implementation process of "Step S204: the M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library" may include: the M-bit dynamic link library writes the name of the target dynamic link library into the shared memory, and notifies the N-bit auxiliary process to read the information in the shared memory.
[0110] When the M-bit program calls the loading function in the M-bit dynamic link library to load the target dynamic link library (N-bit dynamic link library), the M-bit dynamic link library writes the name of the target dynamic link library into the shared memory and notifies the N-bit auxiliary process to read the information in the shared memory.
[0111] The implementation process of “Step S205: the N-bit auxiliary process loads the target dynamic link library, and feeds back the loading result of the target dynamic link library to the M-bit dynamic link library” may include:
[0112] Step S2051: The N-bit auxiliary process reads the name of the target dynamic link library in the shared memory, and loads the target dynamic link library according to the read name.
[0113] The above content mentioned that after the M-bit dynamic link library writes the name of the target dynamic link library into the shared memory, it will notify the N-bit auxiliary process to read the information in the shared memory. After receiving the notification from the M-bit dynamic link library, the N-bit auxiliary process goes to the shared memory to read the information written by the M-bit dynamic link library, that is, the name of the target dynamic link library. After the N-bit auxiliary process reads the name of the target dynamic link library, it loads the target dynamic link library according to the read name.
[0114] Step S2052: The N-bit auxiliary process writes the loading result of the target dynamic link library into the shared memory, and notifies the M-bit dynamic link library to read the loading result of the target dynamic link library from the shared memory.
[0115] After the N-bit auxiliary process finishes loading the target dynamic link library, it writes the loading result of the target dynamic link library into the shared memory and notifies the M-bit dynamic link library to read the loading result of the target dynamic link library from the shared memory. The loading result of the target dynamic link library can indicate whether the target dynamic link library is loaded successfully.
[0116] After receiving the notification from the N-bit auxiliary process, the M-bit dynamic link library reads the loading result of the target dynamic link library from the shared memory. The M-bit program can know whether the target dynamic link library is loaded successfully according to the loading result read by the M-bit dynamic link library from the shared memory. If the target dynamic link library is loaded successfully, the M-bit program calls the target interface in the M-bit dynamic link library (an interface of the target dynamic link library).
[0117] When the M-bit program calls the target interface in the M-bit dynamic link library, "step S207: the M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function that implements the target interface in the target dynamic link library" is executed.
[0118] The implementation process of step S207 may include: the M-bit dynamic link library writes the function call information of the target function into the shared memory, and notifies the N-bit auxiliary process to read the information in the shared memory.
[0119] The function call information may include function name, return value, stack parameters, memory space pointed to by stack pointer parameters, and other information.
[0120] The implementation process of “Step S208: the N-bit auxiliary process executes the target function in the target dynamic link library, and feeds back the execution result of the target function to the M-bit dynamic link library” may include:
[0121] Step S2081, the N auxiliary processes read the function call information in the shared memory, and execute the target function in the target dynamic link library according to the read function call information.
[0122] The above content mentioned that after the M-bit dynamic link library writes the function call information of the target function into the shared memory, it will notify the N-bit auxiliary process to read the information in the shared memory. After receiving the notification from the M-bit dynamic link library, the N-bit auxiliary process goes to the shared memory to read the function call information of the target function, and then executes the target function in the target dynamic link library according to the function call information of the target function.
[0123] Step S2082: The N-bit auxiliary process writes the execution result of the target function into the shared memory, and notifies the M-bit dynamic link library to read the execution result of the target function from the shared memory.
[0124] After the N-bit auxiliary process executes the target function in the target dynamic link library, it writes the execution result of the target function into the shared memory and notifies the M-bit dynamic link library through the semaphore to read the execution result of the target function from the shared memory. After receiving the notification from the N-bit auxiliary process, the M-bit dynamic link library reads the execution result of the target function from the shared memory.
[0125] Based on the method for implementing cross-bit number calling of dynamic link libraries provided in the above embodiment, the method for implementing cross-bit number calling of dynamic link libraries is further described below by taking a 64-bit program calling a 32-bit dynamic link library as an example.
[0126] See also Figure 5 , shows a flow chart of a method for implementing a 64-bit program calling a 32-bit dynamic link library, which may include:
[0127] Step S501: The 64-bit program loads a pre-established 64-bit dynamic link library.
[0128] In this embodiment, a 64-bit dynamic link library is pre-established, and the 64-bit dynamic link library has the same interface as a plurality of 32-bit dynamic link libraries.
[0129] Step S502: The 64-bit dynamic link library creates a 32-bit auxiliary process.
[0130] When a 64-bit dynamic link library is loaded by a 64-bit program, the 64-bit dynamic link library automatically creates a helper process.
[0131] Specifically, when a 64-bit dynamic link library is loaded by a 64-bit program, the loading function in the 64-bit dynamic link library detects whether there is a 32-bit auxiliary process. If there is no 32-bit auxiliary process, the loading function in the 64-bit dynamic link library creates a 32-bit auxiliary process. If there is a 32-bit auxiliary process, the unloading function in the 64-bit dynamic link library first terminates the currently existing 32-bit auxiliary process, and then the loading function in the 64-bit dynamic link library re-creates the 32-bit auxiliary process.
[0132] Step S503: The 32-bit auxiliary process establishes a shared memory.
[0133] After the 64-bit dynamic link library creates a 32-bit auxiliary process, the 32-bit auxiliary process establishes shared memory for communicating with the 64-bit dynamic link library.
[0134] Step S504: the 64-bit program notifies the 64-bit dynamic link library to load the target dynamic link library.
[0135] The 64-bit program calls the loading function (LoadDLL()) in the 64-bit dynamic link library to load the target dynamic link library (such as 32-bit dynamic link library A).
[0136] Step S505: The 64-bit dynamic link library writes the name of the target dynamic link library into the shared memory, and notifies the 32-bit auxiliary process to read the information in the shared memory.
[0137] When a 64-bit program calls the loading function in the 64-bit dynamic link library to load the target dynamic link library (such as 32-bit dynamic link library A), the 64-bit dynamic link library writes the name of the target dynamic link library (such as the name of 32-bit dynamic link library A) into the shared memory and notifies the 32-bit auxiliary process to read the information in the shared memory.
[0138] Step S506: The 32-bit auxiliary process reads the name of the target dynamic link library in the shared memory, and loads the target dynamic link library according to the read name.
[0139] Since both the auxiliary process and the target dynamic link library are 32 bits, after the 32-bit auxiliary process reads the name of the target dynamic link library from the shared memory, it can directly load the target dynamic link library according to the read name.
[0140] Step S507: the 32-bit auxiliary process writes the loading result of the target dynamic link library into the shared memory, and notifies the 64-bit dynamic link library to read the loading result of the target dynamic link library from the shared memory.
[0141] After receiving the notification from the 32-bit auxiliary process, the 64-bit dynamic link library reads the loading result of the target dynamic link library from the shared memory. After the 64-bit program loads the 64-bit dynamic link library, the 64-bit dynamic link library becomes part of the 64-bit program. Therefore, the 64-bit dynamic link library obtains the loading result of the target dynamic link library, which is equivalent to the 64-bit program obtaining the loading result of the target dynamic link library.
[0142] Step S508: If the target dynamic link library is loaded successfully, the 64-bit program calls the target interface in the 64-bit dynamic link library.
[0143] The target interface is the interface of the 32-bit target dynamic link library.
[0144] After the 64-bit program obtains the loading result of the target dynamic link library, if it is known from the loading result that the target dynamic link library is loaded successfully, the target interface in the 64-bit dynamic link library is called.
[0145] Step S509: The 64-bit dynamic link library writes the function call information of the target function that implements the target interface into the shared memory, and notifies the 32-bit auxiliary process to read the information in the shared memory.
[0146] When a 64-bit program calls a target interface in a 64-bit dynamic link library, the 64-bit dynamic link library writes the function call information of the target function that implements the target interface into the shared memory and notifies the 32-bit auxiliary process to read the information in the shared memory.
[0147] Step S510: The 32-bit auxiliary process reads the function call information in the shared memory, and executes the target function in the target dynamic link library according to the read function call information.
[0148] After receiving the notification from the 64-bit dynamic link library, the 32-bit auxiliary process reads the function call information from the shared memory, and then executes the target function in the 32-bit target dynamic link library according to the read function call information.
[0149] Step S511: write the execution result of the target function into the shared memory, and notify the 64-bit dynamic link library to read the execution result of the target function from the shared memory.
[0150] After the 32-bit auxiliary process executes the target function, it writes the execution result of the target function to the shared memory and notifies the 64-bit dynamic link library to read the execution result of the target function from the shared memory. After receiving the notification, the 64-bit dynamic link library reads the execution result of the target function from the shared memory, thus completing the call to the target function in the 32-bit target dynamic link library.
[0151] It should be noted that a 64-bit program can call multiple functions in the same 32-bit dynamic link library. For example, after loading 32-bit dynamic link library A, function a1 and function a2 in 32-bit dynamic link library A can be called, and each function is called in the manner of calling the target function as described above. A 64-bit program can also call functions in multiple 32-bit dynamic link libraries. For example, 32-bit dynamic link library A can be loaded, function a1 in the 32-bit dynamic link library can be called, and 32-bit dynamic link library B can be loaded, function b1 and function b2 in 32-bit dynamic link library B can be called, and the function in each dynamic link library is called in the manner of calling the target function in the target dynamic link library. In addition, a 64-bit program can call the uninstall function in the 64-bit dynamic link library to uninstall a 32-bit dynamic link library. When a 64-bit program calls the uninstall function in the 64-bit dynamic link library to uninstall a 32-bit dynamic link library, the 64-bit dynamic link library can write the name of the 32-bit dynamic link library to be uninstalled into the shared memory, and notify the 32-bit auxiliary process to read the information in the shared memory. After receiving the notification, the 32-bit auxiliary process reads the name of the 32-bit dynamic link library to be uninstalled from the shared memory, and then uninstalls the corresponding 32-bit dynamic link library according to the read name. After the uninstallation is completed, the 32-bit auxiliary process can write the uninstallation result into the shared memory and notify the 64-bit dynamic link library to read the information in the shared memory.
[0152] After the 64-bit program completes the call to the dynamic link library, the 64-bit dynamic link library can be unloaded. When the 64-bit dynamic link library is unloaded, the 32-bit auxiliary process is terminated and the shared memory is released.
[0153] The method for implementing cross-bit number calling of dynamic link libraries provided in the embodiment of the present application realizes the calling of 32-bit dynamic link libraries by 64-bit programs by introducing 64-bit dynamic link libraries and 32-bit auxiliary processes. The introduction of 64-bit dynamic link libraries and 32-bit auxiliary processes, on the one hand, makes it unnecessary to compile 32-bit dynamic link libraries for the method for implementing cross-bit number calling of dynamic link libraries provided in the embodiment of the present application. Since there is no need to compile 32-bit dynamic link libraries, there is no need for the source code of 32-bit dynamic link libraries. On the other hand, it enables 64-bit programs to call 32-bit dynamic link libraries in a manner that is almost completely consistent with calling 64-bit dynamic link libraries. The original calling code of 32-bit dynamic link libraries hardly needs to be changed. In addition, the 32-bit auxiliary process is automatically maintained by the 64-bit dynamic link library, and no special additional maintenance is required for 64-bit programs.
[0154] The above describes the method for implementing cross-bit number calling of dynamic link libraries provided in the embodiment of the present application. The following describes the device corresponding to the method for implementing cross-bit number calling of dynamic link libraries.
[0155] See also Figure 6 , Figure 6 A structural schematic diagram of a device for implementing cross-bit number calling of a dynamic link library provided in an embodiment of the present application, the device may include: an M-bit program driver module 601, an M-bit dynamic link library driver module 602 and an N-bit auxiliary process driver module 603.
[0156] The M-bit program driving module 601 is used to drive the M-bit program to load a pre-established M-bit dynamic link library, wherein the M-bit dynamic link library has the same interface as several N-bit dynamic link libraries, and M and N are both positive integer powers of 2, and M and N are different.
[0157] The M-bit dynamic link library driving module 602 is used to drive the M-bit dynamic link library to create an N-bit auxiliary process.
[0158] The M-bit program driving module 601 is further used to drive the M-bit program to notify the M-bit dynamic link library to load a target dynamic link library, wherein the target dynamic link library is a dynamic link library among several N-bit dynamic link libraries.
[0159] The M-bit dynamic link library driving module 602 is further used to drive the M-bit dynamic link library to notify the N-bit auxiliary process to load the target dynamic link library.
[0160] The N-bit auxiliary process driving module 603 is used to drive the N-bit auxiliary process to load the target dynamic link library, and feed back the loading result of the target dynamic link library to the M-bit dynamic link library.
[0161] The M-bit program driving module 601 is also used to drive the M-bit program to call the target interface in the M-bit dynamic link library when the target dynamic link library is loaded successfully, wherein the target interface is an interface of the target dynamic link library.
[0162] The M-bit dynamic link library driving module 602 is used to drive the M-bit dynamic link library to notify the N-bit auxiliary process to execute the target function that implements the target interface in the target dynamic link library.
[0163] The N-bit auxiliary process driving module 603 is also used to drive the N-bit auxiliary process to execute the target function in the target dynamic link library, and feed back the execution result of the target function to the M-bit dynamic link library.
[0164] In a possible implementation, the M-bit dynamic link library has a loading function and an unloading function. The loading function has codes for detecting whether an N-bit auxiliary process exists and creating an N-bit auxiliary process, and the unloading function has codes for terminating the N-bit auxiliary process.
[0165] When the M-bit dynamic link library driving module 602 drives the M-bit dynamic link library to create the N-bit auxiliary process, it is specifically used to:
[0166] Drive the loading function in the M-bit dynamic link library to detect whether there is an N-bit auxiliary process;
[0167] If the N-bit auxiliary process does not exist, the loading function in the M-bit dynamic link library is driven to create the N-bit auxiliary process;
[0168] If there are N-bit auxiliary processes, the unload function in the M-bit dynamic link library is driven to terminate the N-bit auxiliary process, and the load function in the M-bit dynamic link library is driven to recreate the N-bit auxiliary process.
[0169] In a possible implementation, when the M-bit program driving module 601 drives the M-bit program to notify the M-bit dynamic link library to load the target dynamic link library, it is specifically used to:
[0170] Drive the M-bit program to call the loading function in the M-bit dynamic link library to load the target dynamic link library.
[0171] In a possible implementation, the N-bit auxiliary process driving module 603 is further used to drive the N-bit auxiliary process to establish a shared memory after the M-bit dynamic link library creates the N-bit auxiliary process, and the M-bit dynamic link library communicates with the N-bit auxiliary process through the shared memory.
[0172] In a possible implementation, when the M-bit dynamic link library driving module 602 drives the M-bit dynamic link library to notify the N-bit auxiliary process to load the target dynamic link library, it is specifically used to:
[0173] Driving the M-bit dynamic link library to write the name of the target dynamic link library into the shared memory, and notifying the N-bit auxiliary process to read the information in the shared memory;
[0174] When the N-bit auxiliary process driving module 603 drives the N-bit auxiliary process to load the target dynamic link library and feeds back the loading result of the target dynamic link library to the M-bit dynamic link library, it is specifically used to:
[0175] Drive the N-bit auxiliary process to read the name of the target dynamic link library in the shared memory, load the target dynamic link library according to the read name, write the loading result of the target dynamic link library into the shared memory, and notify the M-bit dynamic link library to read the loading result of the target dynamic link library from the shared memory.
[0176] In a possible implementation, when the M-bit dynamic link library driving module 602 drives the M-bit dynamic link library to notify the N-bit auxiliary process to execute the target function implementing the target interface in the target dynamic link library, it is specifically used to:
[0177] The M-bit dynamic link library writes the function call information of the target function into the shared memory and notifies the N-bit auxiliary process to read the information in the shared memory;
[0178] When the N-bit auxiliary process driving module 603 drives the N-bit auxiliary process to execute the target function in the target dynamic link library and feeds back the execution result of the target function to the M-bit dynamic link library, it is specifically used to:
[0179] Drive the N-bit auxiliary process to read the function call information in the shared memory, execute the target function in the target dynamic link library according to the read function call information, write the execution result of the target function into the shared memory, and notify the M-bit dynamic link library to read the execution result of the target function from the shared memory.
[0180] In a possible implementation, the M-bit program driving module 601 is further used to drive the M-bit program to uninstall the M-bit dynamic link library.
[0181] The M-bit dynamic link library driving module 602 is also used to drive the M-bit dynamic link library to terminate the N-bit auxiliary process.
[0182] The device for implementing cross-bit number calling of dynamic link libraries provided in the embodiment of the present application implements the calling of N-bit dynamic link libraries by M-bit dynamic link libraries and N-bit auxiliary processes. The introduction of M-bit dynamic link libraries and N-bit auxiliary processes, on the one hand, eliminates the need to compile the N-bit dynamic link library. Since there is no need to compile the N-bit dynamic link library, there is no need for the source code of the N-bit dynamic link library. On the other hand, the M-bit program can call the N-bit dynamic link library in a manner that is almost completely consistent with calling the M-bit dynamic link library. The original calling code of the N-bit dynamic link library hardly needs to be changed. In addition, the N-bit auxiliary process is automatically maintained by the M-bit dynamic link library, and no additional maintenance is required for the M-bit program.
[0183] An embodiment of the present application also provides an electronic device, which may include: at least one processor, at least one communication interface, at least one memory and at least one communication bus.
[0184] In the embodiment of the present application, the number of the processor, the communication interface, the memory, and the communication bus is at least one, and the processor, the communication interface, and the memory communicate with each other through the communication bus;
[0185] The processor may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application;
[0186] The memory may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory;
[0187] The memory stores a program, and the processor can call the program stored in the memory, and the program is used to implement the steps of the method for implementing cross-bit number calling of dynamic link libraries provided in the above embodiment.
[0188] An embodiment of the present application also provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the steps of the method for implementing cross-bit number calling of a dynamic link library provided in the above embodiment.
[0189] An embodiment of the present application also provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the steps of the method for implementing cross-bit number calling of a dynamic link library provided in the above embodiment.
[0190] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0191] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0192] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0193] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A method for implementing cross-bit number calling of dynamic link libraries, It is characterized in that include: The M-bit program loads a pre-established M-bit dynamic link library, the M-bit dynamic link library creates an N-bit auxiliary process, wherein the M-bit dynamic link library has the same interface as a plurality of N-bit dynamic link libraries, M and N are both positive integer powers of 2, and M is different from N; The M-bit program notifies the M-bit dynamic link library to load a target dynamic link library, the M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library, the N-bit auxiliary process loads the target dynamic link library, and feeds back a loading result of the target dynamic link library to the M-bit dynamic link library, wherein the target dynamic link library is a dynamic link library among the plurality of N-bit dynamic link libraries; If the target dynamic link library is loaded successfully, the M-bit program calls the target interface in the M-bit dynamic link library, the M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function in the target dynamic link library that implements the target interface, the N-bit auxiliary process executes the target function in the target dynamic link library and feeds back the execution result of the target function to the M-bit dynamic link library, wherein the target interface is an interface of the target dynamic link library.
2. The method for implementing cross-bit number calling of dynamic link library according to claim 1, It is characterized in that The M-bit dynamic link library has a loading function and an unloading function, wherein the loading function has a code for detecting whether an N-bit auxiliary process exists and creating an N-bit auxiliary process, and the unloading function has a code for terminating the N-bit auxiliary process; The M-bit dynamic link library creates an N-bit auxiliary process, including: The loading function in the M-bit dynamic link library detects whether there is an N-bit auxiliary process; If the N-bit auxiliary process does not exist, the loading function in the M-bit dynamic link library creates the N-bit auxiliary process; If there are N-bit auxiliary processes, the unloading function in the M-bit dynamic link library terminates the N-bit auxiliary processes, and the loading function in the M-bit dynamic link library recreates the N-bit auxiliary processes.
3. The method for implementing the cross-bit number calling dynamic link library according to claim 2, It is characterized in that The M-bit program notifies the M-bit dynamic link library to load the target dynamic link library, including: The M-bit program calls a loading function in the M-bit dynamic link library to load a target dynamic link library.
4. The method for implementing cross-bit number calling of dynamic link library according to claim 1, It is characterized in that Also includes: After the M-bit dynamic link library creates the N-bit auxiliary process, the N-bit auxiliary process establishes a shared memory, and the M-bit dynamic link library communicates with the N-bit auxiliary process through the shared memory.
5. The method for implementing cross-bit number calling of dynamic link library according to claim 4, It is characterized in that The M-bit dynamic link library notifies the N-bit auxiliary process to load the target dynamic link library, including: The M-bit dynamic link library writes the name of the target dynamic link library into the shared memory, and notifies the N-bit auxiliary process to read the information in the shared memory; The N-bit auxiliary process loads the target dynamic link library and feeds back the loading result of the target dynamic link library to the M-bit dynamic link library, including: The N-bit auxiliary process reads the name of the target dynamic link library in the shared memory, loads the target dynamic link library according to the read name, writes the loading result of the target dynamic link library into the shared memory, and notifies the M-bit dynamic link library to read the loading result of the target dynamic link library from the shared memory.
6. The method for implementing cross-bit number calling of dynamic link library according to claim 4, It is characterized in that The M-bit dynamic link library notifies the N-bit auxiliary process to execute the target function implementing the target interface in the target dynamic link library, including: The M-bit dynamic link library writes the function call information of the target function into the shared memory, and notifies the N-bit auxiliary process to read the information in the shared memory; The N-bit auxiliary process executes the target function in the target dynamic link library and feeds back the execution result of the target function to the M-bit dynamic link library, including: The N-bit auxiliary process reads the function call information in the shared memory, executes the target function in the target dynamic link library according to the read function call information, writes the execution result of the target function into the shared memory, and notifies the M-bit dynamic link library to read the execution result of the target function from the shared memory.
7. The method for implementing cross-bit number calling of dynamic link library according to claim 1, It is characterized in that Also includes: The M-bit program unloads the M-bit dynamic link library, and the M-bit dynamic link library terminates the N-bit auxiliary process.
8. A device for implementing cross-bit number calling of dynamic link library, It is characterized in that include: M-bit program driver module, M-bit dynamic link library driver module and N-bit auxiliary process driver module; The M-bit program driving module is used to drive the M-bit program to load a pre-established M-bit dynamic link library, wherein the M-bit dynamic link library has the same interface as a plurality of N-bit dynamic link libraries, M and N are both positive integer powers of 2, and M is different from N; The M-bit dynamic link library driving module is used to drive the M-bit dynamic link library to create an N-bit auxiliary process; The M-bit program driving module is further used to drive the M-bit program to notify the M-bit dynamic link library to load a target dynamic link library, wherein the target dynamic link library is a dynamic link library among the plurality of N-bit dynamic link libraries; The M-bit dynamic link library driving module is further used to drive the M-bit dynamic link library to notify the N-bit auxiliary process to load the target dynamic link library; The N-bit auxiliary process driving module is used to drive the N-bit auxiliary process to load the target dynamic link library, and feed back the loading result of the target dynamic link library to the M-bit dynamic link library; The M-bit program driving module is further used to drive the M-bit program to call a target interface in the M-bit dynamic link library when the target dynamic link library is loaded successfully, wherein the target interface is an interface of the target dynamic link library; The M-bit dynamic link library driving module is used to drive the M-bit dynamic link library to notify the N-bit auxiliary process to execute the target function of the target dynamic link library that implements the target interface; The N-bit auxiliary process driving module is also used to drive the N-bit auxiliary process to execute the target function in the target dynamic link library, and feed back the execution result of the target function to the M-bit dynamic link library.
9. An electronic device, It is characterized in that The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the steps of the method for implementing cross-bit number calling of dynamic link libraries as described in any one of claims 1 to 7.
10. A computer storage medium, It is characterized in that The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the steps of the method for implementing cross-bit number calling of a dynamic link library as described in any one of claims 1 to 7.
