Application program compiling method and device, terminal and storage medium

By converting the dynamic link library in the AUTOSAR AP platform into a static link library and creating a third dynamic link library that references the static link library, the conflicting interfaces are hidden, conflicts and reference errors in the dynamic library reference relationship are solved, and the application's reliability is ensured. stability.

CN118567650APending Publication Date: 2024-08-30NEUSOFT REACH AUTOMOBILE TECH (SHENYANG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410600133.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

In the AUTOSAR AP platform, mutual references and extensions between dynamic link libraries lead to conflicts, and existing technologies cannot effectively avoid reference errors and functional errors.

Method used

An application is written by compiling the first dynamic link library into a static link library and creating a third dynamic link library that references the static link library, hides conflicting interfaces, and then calls functions in the second and third dynamic link libraries.

Benefits of technology

It effectively solves conflicts and reference errors caused by dynamic library reference relationships, and avoids functional errors and program errors in applications caused by reference errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567650A
    Figure CN118567650A
Patent Text Reader

Abstract

The invention discloses an application program compiling method and device, a terminal and a storage medium, and the method comprises the steps that a first dynamic link library and a second dynamic link library are obtained, the first dynamic link library comprises an extension library, and the second dynamic link library and the extension library have the same function name; compiling the first dynamic link library into a static link library; a third dynamic link library is created, and the third dynamic link library refers to the static link library; and calling functions in the second dynamic link library and the third dynamic link library to write an application program. According to the method, the parameter hiding function is compiled through conversion and packaging of the static link library and the dynamic link library and the created third dynamic link library, conflicts and reference errors caused by a complex dynamic library reference relation in an AUTOSAR AP platform are effectively solved, and functional errors and program errors of an APP cannot be caused by the reference errors any more.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an application compilation method, device, terminal, and storage medium. Background Art

[0002] In the Adaptive Platform (AP) standard of the AUTOSAR (Automotive Open System Architecture) standard, due to the mutual references between modules and the mutual references and extensions between libraries, conflicts may arise between the dynamic link libraries referenced during the application programming process.

[0003] Currently, no solution has been proposed for avoiding conflicts between referenced dynamic link libraries during the process of writing an application. Summary of the Invention

[0004] The main purpose of this application is to provide an application compilation method, device, terminal and storage medium to solve the problem of conflicts in dynamic link libraries referenced in the process of writing applications.

[0005] To achieve the above objectives, in a first aspect, the present application provides an application compilation method, comprising:

[0006] Obtaining a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name;

[0007] Compiling the first dynamic link library into a static link library;

[0008] creating a third dynamic link library, wherein the third dynamic link library references the static link library;

[0009] An application program is written by calling functions in the second dynamic link library and the third dynamic link library.

[0010] In a possible implementation, compiling the first dynamic link library into a static link library includes:

[0011] Get the first rule file;

[0012] In the compilation library, all dynamic source files in the first dynamic link library are compiled into static source files using the first rule file, and a static link library is generated based on the compiled static source files.

[0013] In a possible implementation, compiling the first dynamic link library into a static link library includes:

[0014] Get the first rule file;

[0015] In the compilation library, the first rule file is used to sequentially perform pre-compilation, compilation and assembly processing on the first dynamic link library to obtain an executable file;

[0016] Get the number and / or index of the executable file;

[0017] Compress and pack the executable file based on the serial number and / or index number of the executable file to obtain a compressed executable file;

[0018] Compile all dynamic source files in the compressed executable file into static source files, and generate a static link library based on the compiled static source files.

[0019] In a possible implementation, creating the third dynamic link library includes:

[0020] Create a new second rule file;

[0021] The third dynamic link library is compiled using the second rule file in the compilation library.

[0022] In a possible implementation, after the compilation library compiles the third dynamic link library using the second rule file, the method further includes:

[0023] encapsulating the third dynamic link library to obtain an encapsulated third dynamic link library;

[0024] New compilation parameters are added to the packaged third dynamic link library, and the packaged third dynamic link library is linked to the static link library.

[0025] In a possible implementation, calling functions in the second dynamic link library and the third dynamic link library to write an application includes:

[0026] Use the find_package command to find the second dynamic link library and the third dynamic link library respectively;

[0027] The function interface of the second dynamic link library is called to link the second dynamic link library and the third dynamic link library, so as to write an application based on the functions in the second dynamic link library and the third dynamic link library.

[0028] In a possible implementation, calling functions in the second dynamic link library and the third dynamic link library to write an application includes:

[0029] Create a new application and configure the application name;

[0030] Compiling the header file and source file in the second dynamic link library, and the header file and source file in the third dynamic link library;

[0031] Obtaining functions in header files and source files in the second dynamic link library, and functions in header files and source files in the third dynamic link library;

[0032] An application is written by calling functions in the header file and source file in the second dynamic link library and functions in the header file and source file in the third dynamic link library.

[0033] In a second aspect, an embodiment of the present invention provides an application compilation device, comprising:

[0034] an acquisition module, configured to acquire a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name;

[0035] A compiling module, used for compiling the first dynamic link library into a static link library;

[0036] A creation module is used to create a third dynamic link library, wherein the third dynamic link library references the static link library;

[0037] The calling module is used to call functions in the second dynamic link library and the third dynamic link library to write an application program.

[0038] In a third aspect, an embodiment of the present invention provides a terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above application compilation methods when executing the computer program.

[0039] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of any of the above application compilation methods.

[0040] An embodiment of the present invention provides an application compilation method, device, terminal, and storage medium, comprising: first obtaining a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name; then compiling the first dynamic link library into a static link library; then creating a third dynamic link library, wherein the third dynamic link library references the static link library; and finally calling functions in the second dynamic link library and the third dynamic link library to write an application. The present invention effectively resolves conflicts and reference errors caused by complex dynamic library reference relationships in the AUTOSAR AP platform by converting and encapsulating static link libraries and dynamic link libraries, and creating a third dynamic link library to compile parameter-hidden functions, so that APP applications will no longer suffer functional errors and program errors due to reference errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The drawings that constitute part of this application are used to provide a further understanding of this application and make other features, objects and advantages of this application more apparent. The illustrative embodiment drawings of this application and their descriptions are used to explain this application and do not constitute an improper limitation of this application. In the drawings:

[0042] Figure 1 This is a flowchart of an implementation method of an application compilation method provided by an embodiment of the present invention;

[0043] Figure 2 This is a flowchart of another application compilation method provided by an embodiment of the present invention;

[0044] Figure 3 This is a flowchart of another application compilation method provided by an embodiment of the present invention;

[0045] Figure 4 This is a schematic diagram of the structure of an application compilation device provided by an embodiment of the present invention;

[0046] Figure 5 is a schematic diagram of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0048] The terms "first," "second," "third," "fourth," and so forth (if any) in the description and claims of the present invention and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate, such that the embodiments of the present invention described herein can be practiced in sequences other than those illustrated or described herein.

[0049] It should be understood that in various embodiments of the present invention, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0050] It should be understood that in the present invention, "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to these processes, methods, products or apparatuses.

[0051] It should be understood that in the present invention, "multiple" refers to two or more. "And / or" is only a description of the association relationship of associated objects, indicating that three relationships can exist. For example, and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "Contains A, B and C", "Contains A, B, C" means that A, B, and C are all included, "Contains A, B or C" means that one of A, B, and C is included, and "Contains A, B and / or C" means that any one, any two, or any three of A, B, and C are included.

[0052] It should be understood that, in the present invention, "B corresponding to A," "B corresponding to A," "A corresponds to B," or "B corresponds to A" means that B is associated with A and B can be determined based on A. Determining B based on A does not mean determining B based solely on A; B can also be determined based on A and / or other information. A and B match when the similarity between A and B is greater than or equal to a preset threshold.

[0053] Depending on the context, "if" as used herein may be interpreted as "when" or "when" or "in response to determining" or "in response to detecting."

[0054] The following specific embodiments are used to describe the technical solution of the present invention in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0055] In order to make the purpose, technical solutions and advantages of the present invention more clear, specific embodiments will be described below with reference to the accompanying drawings.

[0056] In the Adaptive Platform (AP) standard of the AUTOSAR (Automotive Open System Architecture) standard, due to the mutual references between modules and the mutual references and extensions between libraries, conflicts may arise between the dynamic link libraries referenced during the application programming process.

[0057] like Figure 1As shown in the following example, an app is written that primarily relies on dynamic link libraries A.so and B.so. Dynamic link library B.so's extension library is BNew. The extension library BNew uses the same function names as the dynamic link library B.so, but with expanded and updated functionality. Furthermore, dynamic link library A.so includes the extension library BNew.

[0058] However, if the APP application only wants to use the functions in the dynamic link library B.so, then when referencing a function in the dynamic link library B.so when coding the APP application, it may indirectly reference the same function name in the extension library BNew through the dynamic link library A.so, resulting in a reference error, which is a link library conflict.

[0059] Therefore, the present application proposes an application compilation method to solve the problem of conflicts among dynamic link libraries referenced during the application compilation process.

[0060] In one embodiment, Figure 2 As shown, a method for compiling an application is provided, comprising the following steps:

[0061] Step S201: Acquire a first dynamic link library and a second dynamic link library.

[0062] The first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name.

[0063] like Figure 3 As shown, assume that the first dynamic link library is A.so and the second dynamic link library is B.so, wherein the first dynamic link library includes an extension library BNew, and the second dynamic link library B.so and the extension library BNew have the same function name.

[0064] Step S202: compile the first dynamic link library into a static link library.

[0065] In one embodiment, compiling the first dynamic link library into a static link library includes: obtaining a first rule file; compiling all dynamic source files in the first dynamic link library into static source files using the first rule file in the compilation library, and generating a static link library based on the compiled static source files.

[0066] Specifically, assume that the first rule file is a CMakeLists.txt file, wherein the CMakeLists.txt file is a rule file describing compilation and linking required for CMake to generate a Makefile file.

[0067] When compiling the library, use the CMakeLists.txt file to compile all dynamic source files in the first dynamic link library A.so into static source files, such as

[0068] add_library(A SHARED source file 1 [source file 2]...) is changed to add_library(A STATIC source file 1 [source file 2]...)

[0069] Then, a static link library Aa is generated based on the compiled static source files.

[0070] In another embodiment, compiling a first dynamic link library into a static link library includes: obtaining a first rule file; using the first rule file in the compilation library to perform precompilation, compilation and assembly processing on the first dynamic link library in sequence to obtain an executable file; obtaining the number and / or index number of the executable file; compressing and packaging the executable file based on the number and / or index number of the executable file to obtain a compressed executable file; compiling all dynamic source files in the compressed executable file into static source files, and generating a static link library based on the compiled static source files.

[0071] Step S203: Create a third dynamic link library.

[0072] The third dynamic link library references the static link library.

[0073] Creating the third dynamic link library includes: creating a new second rule file; and compiling the third dynamic link library using the second rule file in the compilation library.

[0074] After the compilation library compiles the third dynamic link library using the second rule file, it also includes: packaging the third dynamic link library to obtain a packaged third dynamic link library; adding new compilation parameters to the packaged third dynamic link library, and linking the packaged third dynamic link library to the static link library.

[0075] Specifically, a third dynamic link library ANew.so may be created first, wherein the third dynamic link library references the static link library Aa.

[0076] Create a second rule file, such as CMakeLists.txt, and then use CMakeLists.txt to compile a new dynamic library in the compilation library, that is, the third dynamic link library ANew.so, and then encapsulate the third dynamic link library ANew.so, add compilation parameters such as -Wl, -Bsymbolic-Wl, --exclude-libs, ALL, etc., and then link to the static link library Aa. The specific code flow is as follows:

[0077]

[0078] Step S204: calling functions in the second dynamic link library and the third dynamic link library to write an application.

[0079] In one embodiment, calling functions in the second dynamic link library and the third dynamic link library to write an application includes: using the find_package command to find the second dynamic link library and the third dynamic link library respectively; calling the function interface of the second dynamic link library to link the second dynamic link library and the third dynamic link library to write an application based on the functions in the second dynamic link library and the third dynamic link library.

[0080] Specifically, when writing an application, you can call the second dynamic link library B.so and the third dynamic link library ANew.so. Since the third dynamic link library ANew.so successfully hides the conflicting interface, the interface function names exposed to the application in the two dynamic link libraries no longer conflict, and there will no longer be conflicts in application call interfaces, resulting in unexpected behavior.

[0081] For example, when writing an application APP, the following code can be written directly in CMakelists.txt:

[0082]

[0083] In the program file, when writing the code, the function interface interface1 in the second dynamic link library B.so is called. When the program is loaded and run, the interface interface1 in the second dynamic link library B.so is called. The interface in the third dynamic link library ANew.so has been effectively hidden and will not be exposed to the APP application. Therefore, the APP application will not have a situation where the called interface is inconsistent with the expected function.

[0084] In another embodiment, calling functions in the second dynamic link library and the third dynamic link library to write an application includes: creating a new application and configuring the name of the application; writing header files and source files in the second dynamic link library, as well as header files and source files in the third dynamic link library; obtaining functions in the header files and source files in the second dynamic link library, as well as functions in the header files and source files in the third dynamic link library; calling functions in the header files and source files in the second dynamic link library, as well as functions in the header files and source files in the third dynamic link library to write the application.

[0085] An embodiment of the present invention provides an application compilation method, comprising: first obtaining a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name; then compiling the first dynamic link library into a static link library; then creating a third dynamic link library, wherein the third dynamic link library references the static link library; and finally calling functions in the second dynamic link library and the third dynamic link library to compile an application. The present invention effectively resolves conflicts and reference errors caused by complex dynamic library reference relationships in the AUTOSAR AP platform by converting and encapsulating static link libraries and dynamic link libraries and creating a third dynamic link library to compile parameter-hiding functions, thereby preventing APP applications from causing functional and program errors due to reference errors.

[0086] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0087] The following are device embodiments of the present invention. For details not fully described therein, reference may be made to the corresponding method embodiments described above.

[0088] Figure 4 A schematic diagram of the structure of an application compilation device provided by an embodiment of the present invention is shown. For ease of explanation, only the parts related to the embodiment of the present invention are shown. The application compilation device includes an acquisition module 401, a compilation module 402, a creation module 403, and a calling module 404. The details are as follows:

[0089] An acquisition module 401 is configured to acquire a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name;

[0090] Compilation module 402, used for compiling the first dynamic link library into a static link library;

[0091] A creation module 403 is configured to create a third dynamic link library, wherein the third dynamic link library references the static link library;

[0092] The calling module 404 is used to call functions in the second dynamic link library and the third dynamic link library to write an application program.

[0093] In a possible implementation, the compiling module 402 is further configured to obtain a first rule file;

[0094] In the compilation library, all dynamic source files in the first dynamic link library are compiled into static source files using the first rule file, and a static link library is generated based on the compiled static source files.

[0095] In a possible implementation, the compiling module 402 is further configured to obtain a first rule file;

[0096] In the compilation library, the first rule file is used to sequentially perform pre-compilation, compilation and assembly processing on the first dynamic link library to obtain an executable file;

[0097] Get the number and / or index of the executable file;

[0098] Compress and pack the executable file based on the serial number and / or index number of the executable file to obtain a compressed executable file;

[0099] Compile all dynamic source files in the compressed executable file into static source files, and generate a static link library based on the compiled static source files.

[0100] In a possible implementation, the creation module 403 is further configured to create a second rule file;

[0101] The third dynamic link library is compiled using the second rule file in the compilation library.

[0102] In a possible implementation, after the creation module 403, a link module is further included, and the link module is used to encapsulate the third dynamic link library to obtain the encapsulated third dynamic link library;

[0103] New compilation parameters are added to the packaged third dynamic link library, and the packaged third dynamic link library is linked to the static link library.

[0104] In a possible implementation, the calling module 404 is further configured to use the find_package command to search for the second dynamic link library and the third dynamic link library respectively;

[0105] The function interface of the second dynamic link library is called to link the second dynamic link library and the third dynamic link library, so as to write an application based on the functions in the second dynamic link library and the third dynamic link library.

[0106] In a possible implementation, the calling module 404 is further used to create a new application and configure the name of the application;

[0107] Compiling the header file and source file in the second dynamic link library, and the header file and source file in the third dynamic link library;

[0108] Obtaining functions in header files and source files in the second dynamic link library, and functions in header files and source files in the third dynamic link library;

[0109] An application is written by calling functions in the header file and source file in the second dynamic link library and functions in the header file and source file in the third dynamic link library.

[0110] An embodiment of the present invention provides an application compilation device, which is mainly used to: first obtain a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name; then compile the first dynamic link library into a static link library; then create a third dynamic link library, wherein the third dynamic link library references the static link library; and finally call the functions in the second dynamic link library and the third dynamic link library to write an application. The present invention effectively resolves conflicts and reference errors caused by complex dynamic library reference relationships in the AUTOSAR AP platform by converting and encapsulating static link libraries and dynamic link libraries, and creating a third dynamic link library to compile parameter hidden functions, so that APP applications will no longer suffer functional errors and program errors due to reference errors.

[0111] Figure 5 Schematic diagram of a terminal provided by an embodiment of the present invention. Figure 5 As shown, the terminal 5 of this embodiment includes: a processor 501, a memory 502, and a computer program 505 stored in the memory 502 and executable on the processor 501. When the processor 501 executes the computer program 505, the steps in the above-mentioned various application compilation method embodiments are implemented, such as Figure 2 Alternatively, when the processor 501 executes the computer program 505, the functions of the modules / units in the above-mentioned embodiments of the application program compilation device are realized, such as Figure 4 Functionality of modules / units 401-404 is shown.

[0112] The present invention further provides a readable storage medium, wherein the readable storage medium stores a computer program. When the computer program is executed by a processor, it is used to implement an application compilation method provided in various embodiments described above, including:

[0113] Obtaining a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name;

[0114] Compiling the first dynamic link library into a static link library;

[0115] creating a third dynamic link library, wherein the third dynamic link library references the static link library;

[0116] An application program is written by calling functions in the second dynamic link library and the third dynamic link library.

[0117] In a possible implementation, compiling the first dynamic link library into a static link library includes:

[0118] Get the first rule file;

[0119] In the compilation library, all dynamic source files in the first dynamic link library are compiled into static source files using the first rule file, and a static link library is generated based on the compiled static source files.

[0120] In a possible implementation, compiling the first dynamic link library into a static link library includes:

[0121] Get the first rule file;

[0122] In the compilation library, the first rule file is used to sequentially perform pre-compilation, compilation and assembly processing on the first dynamic link library to obtain an executable file;

[0123] Get the number and / or index of the executable file;

[0124] Compress and pack the executable file based on the serial number and / or index number of the executable file to obtain a compressed executable file;

[0125] Compile all dynamic source files in the compressed executable file into static source files, and generate a static link library based on the compiled static source files.

[0126] In a possible implementation, creating the third dynamic link library includes:

[0127] Create a new second rule file;

[0128] The third dynamic link library is compiled using the second rule file in the compilation library.

[0129] In a possible implementation, after the compilation library compiles the third dynamic link library using the second rule file, the method further includes:

[0130] encapsulating the third dynamic link library to obtain an encapsulated third dynamic link library;

[0131] New compilation parameters are added to the packaged third dynamic link library, and the packaged third dynamic link library is linked to the static link library.

[0132] In a possible implementation, calling functions in the second dynamic link library and the third dynamic link library to write an application includes:

[0133] Use the find_package command to find the second dynamic link library and the third dynamic link library respectively;

[0134] The function interface of the second dynamic link library is called to link the second dynamic link library and the third dynamic link library, so as to write an application based on the functions in the second dynamic link library and the third dynamic link library.

[0135] In a possible implementation, calling functions in the second dynamic link library and the third dynamic link library to write an application includes:

[0136] Create a new application and configure the application name;

[0137] Compiling the header file and source file in the second dynamic link library, and the header file and source file in the third dynamic link library;

[0138] Obtaining functions in header files and source files in the second dynamic link library, and functions in header files and source files in the third dynamic link library;

[0139] An application is written by calling functions in the header file and source file in the second dynamic link library and functions in the header file and source file in the third dynamic link library.

[0140] Among them, the readable storage medium can be a computer storage medium or a communication medium. Communication media include any medium that facilitates the transmission of computer programs from one place to another. Computer storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer. For example, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application-specific integrated circuit (ASIC). In addition, the ASIC can be located in a user device. Of course, the processor and the readable storage medium can also exist in a communication device as discrete components. The readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0141] The present invention also provides a program product, comprising execution instructions stored in a readable storage medium. At least one processor of a device can read the execution instructions from the readable storage medium, and the at least one processor executes the execution instructions so that the device implements an application compilation method provided in various embodiments described above, including:

[0142] Obtaining a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name;

[0143] Compiling the first dynamic link library into a static link library;

[0144] creating a third dynamic link library, wherein the third dynamic link library references the static link library;

[0145] An application program is written by calling functions in the second dynamic link library and the third dynamic link library.

[0146] In a possible implementation, compiling the first dynamic link library into a static link library includes:

[0147] Get the first rule file;

[0148] In the compilation library, all dynamic source files in the first dynamic link library are compiled into static source files using the first rule file, and a static link library is generated based on the compiled static source files.

[0149] In a possible implementation, compiling the first dynamic link library into a static link library includes:

[0150] Get the first rule file;

[0151] In the compilation library, the first rule file is used to sequentially perform pre-compilation, compilation and assembly processing on the first dynamic link library to obtain an executable file;

[0152] Get the number and / or index of the executable file;

[0153] Compress and pack the executable file based on the serial number and / or index number of the executable file to obtain a compressed executable file;

[0154] Compile all dynamic source files in the compressed executable file into static source files, and generate a static link library based on the compiled static source files.

[0155] In a possible implementation, creating the third dynamic link library includes:

[0156] Create a new second rule file;

[0157] The third dynamic link library is compiled using the second rule file in the compilation library.

[0158] In a possible implementation, after the compilation library compiles the third dynamic link library using the second rule file, the method further includes:

[0159] encapsulating the third dynamic link library to obtain an encapsulated third dynamic link library;

[0160] New compilation parameters are added to the packaged third dynamic link library, and the packaged third dynamic link library is linked to the static link library.

[0161] In a possible implementation, calling functions in the second dynamic link library and the third dynamic link library to write an application includes:

[0162] Use the find_package command to find the second dynamic link library and the third dynamic link library respectively;

[0163] The function interface of the second dynamic link library is called to link the second dynamic link library and the third dynamic link library, so as to write an application based on the functions in the second dynamic link library and the third dynamic link library.

[0164] In a possible implementation, calling functions in the second dynamic link library and the third dynamic link library to write an application includes:

[0165] Create a new application and configure the application name;

[0166] Compiling the header file and source file in the second dynamic link library, and the header file and source file in the third dynamic link library;

[0167] Obtaining functions in header files and source files in the second dynamic link library, and functions in header files and source files in the third dynamic link library;

[0168] An application is written by calling functions in the header file and source file in the second dynamic link library and functions in the header file and source file in the third dynamic link library.

[0169] In the embodiments of the above-mentioned devices, it should be understood that the processor may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0170] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.

Claims

1. A method for compiling an application, characterized in that: include: Acquire a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name; Compiling the first dynamic link library into a static link library; Creating a third dynamic link library, wherein the third dynamic link library references the static link library; The application is written by calling functions in the second dynamic link library and the third dynamic link library.

2. The application compiling method according to claim 1, characterized in that: The step of compiling the first dynamic link library into a static link library comprises: Get the first rule file; In the compilation library, all dynamic source files in the first dynamic link library are compiled into static source files using the first rule file, and the static link library is generated based on the compiled static source files.

3. The application compiling method according to claim 1, characterized in that: The step of compiling the first dynamic link library into a static link library comprises: Get the first rule file; In the compilation library, the first rule file is used to sequentially perform pre-compilation, compilation and assembly processing on the first dynamic link library to obtain an executable file; Obtaining the serial number and / or index number of the executable file; Compressing and packaging the executable file based on the serial number and / or index number of the executable file to obtain a compressed executable file; All dynamic source files in the compressed executable file are compiled into static source files, and the static link library is generated based on the compiled static source files.

4. The application compiling method according to claim 1, characterized in that: The step of creating the third dynamic link library comprises: Create a new second rule file; The third dynamic link library is compiled using the second rule file in the compilation library.

5. The application compiling method according to claim 4, characterized in that: After the compiling library compiles the third dynamic link library using the second rule file, the method further includes: Encapsulating the third dynamic link library to obtain an encapsulated third dynamic link library; A new compilation parameter is added to the packaged third dynamic link library, and the packaged third dynamic link library is linked to the static link library.

6. The application compiling method according to claim 1, characterized in that: The step of calling functions in the second dynamic link library and the third dynamic link library to write an application program comprises: Using the find_package command to search for the second dynamic link library and the third dynamic link library respectively; The function interface of the second dynamic link library is called to link the second dynamic link library and the third dynamic link library, so as to write the application based on the functions in the second dynamic link library and the third dynamic link library.

7. The application compiling method according to claim 1, characterized in that: The step of calling functions in the second dynamic link library and the third dynamic link library to write an application program comprises: Create a new application and configure the name of the application; Compiling the header file and source file in the second dynamic link library, and the header file and source file in the third dynamic link library; Obtaining functions in header files and source files in the second dynamic link library, and functions in header files and source files in the third dynamic link library; The application is written by calling functions in header files and source files in the second dynamic link library and functions in header files and source files in the third dynamic link library.

8. An application compilation device, characterized in that: include: an acquisition module, configured to acquire a first dynamic link library and a second dynamic link library, wherein the first dynamic link library includes an extension library, and the second dynamic link library and the extension library have the same function name; A compiling module, used for compiling the first dynamic link library into a static link library; A creation module, used for creating a third dynamic link library, wherein the third dynamic link library references the static link library; The calling module is used to call the functions in the second dynamic link library and the third dynamic link library to write an application program.

9. A terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the application compilation method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the application compilation method according to any one of claims 1 to 7 are implemented.