Local interface declaration and linkage in application interface layer module, and function execution method
Patent Information
- Application Number
- CN202611090500.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-10-23
AI Technical Summary
此时,转换器无法在应用接口层的中间文件中有效识别出哪些接口属于本地接口
[0012]根据本发明实施例的另一方面,还提供了一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如本发明任一实施例所述的应用接口层模块中本地接口声明和链接方法,或者实现如本发明任一实施例所述的应用接口层中本地接口函数执行方法的步骤。
Smart Images

Figure CN122963830A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method for declaring and linking local interfaces in an application interface layer module, a method for executing local interface functions in an application interface layer, an apparatus, a restricted device, an electronic device, a medium, and a product. Background Technology
[0002] In an embedded operating system based on the WebAssembly runtime environment, the application is compiled into an intermediate file in wasm format. After being loaded into a loadable file by a converter, it is linked with the Application Programming Interface (API) provided by the application interface layer within the embedded operating system to generate an executable file. The programming language used by the application interface layer API is the same as that used for application development. When developing the application interface layer API, the interface is usually declared as a native interface and implemented in C language within the operating system to improve the execution performance of the application interface layer API, thereby improving the running performance of the application.
[0003] In existing technologies, mainstream programming languages support compiling source code into Wasm files. Besides the interface declaration, Wasm files do not contain other attribute information for interface functions. Embedded operating systems also need to compile and output Wasm files when developing application interface layer APIs. In this case, the converter cannot effectively identify which interfaces are native interfaces within the intermediate files of the application interface layer. Therefore, in an application interface layer module implemented in existing technologies, either all interfaces are implemented as native interfaces, or all interfaces are implemented as non-native interfaces (also known as generic interfaces). This limits the implementation methods and requirements for the coexistence of native and non-native interfaces in an application interface layer module. Summary of the Invention
[0004] This invention provides a method for declaring and linking local interfaces in an application interface layer module, a method for executing local interface functions in the application interface layer, an apparatus, a restricted device, an electronic device, a medium, and a product, thereby realizing the coexistence definition of local interfaces and general interfaces in an application interface layer module.
[0005] According to one aspect of the present invention, a method for declaring and linking local interfaces in an application interface layer module is provided, executed by a converter, the method comprising: Obtain the intermediate files of each application module in the application interface layer. Each application module intermediate file includes local interface functions for local interface attributes and / or general interface functions for general interface attributes. Extract the local interface functions identified as local interface attributes from the intermediate files of each application module, and construct a local interface table based on all local interface functions in the application interface layer. Based on the global index of each local interface function in the local interface table, and the underlying implementation functions in the embedded operating system corresponding to each local interface function, application interface layer links and internal links of the embedded operating system are established for the intermediate files of each application module, thus obtaining the loadable files of each application module.
[0006] According to another aspect of the present invention, a method for executing local interface functions in an application interface layer is provided, executed by an embedded operating system, the method comprising: Load and install the loadable files of each application module in the application interface layer in the embedded operating system to obtain multiple application interfaces of the application interface layer. Each application interface includes a local interface for linking to the underlying implementation functions in the embedded operating system, and / or a general interface for linking to general functions in the application interface layer. In response to a call instruction to the target local interface in the application interface layer, locate the target underlying implementation function that matches the target local interface and execute the target underlying implementation function.
[0007] According to another aspect of the present invention, a local interface declaration and linking device in an application interface layer module is also provided, configured in a converter, the device comprising: The intermediate file acquisition module is used to acquire the intermediate files of each application module in the application interface layer. Each application module's intermediate file includes local interface functions for local interface attributes and / or general interface functions for general interface attributes. The local interface table construction module is used to extract local interface functions identified as local interface attributes from the intermediate files of each application module, and construct the local interface table based on all local interface functions in the application interface layer. The link establishment module is used to establish application interface layer links and embedded operating system internal links for the intermediate files of each application module based on the global index of each local interface function in the local interface table and the underlying implementation functions in the embedded operating system corresponding to each local interface function, so as to obtain the loadable files of each application module.
[0008] According to another aspect of the present invention, a native interface function execution device in an application interface layer is also provided, configured in an embedded operating system, the device comprising: The application interface installation module is used to load and install the loadable files of each application module in the application interface layer in the embedded operating system, thereby obtaining multiple application interfaces of the application interface layer. Each application interface includes a local interface for linking to the underlying implementation functions in the embedded operating system, and / or a general interface for linking to general functions in the application interface layer. The local interface invocation module is used to respond to invocation instructions for the target local interface in the application interface layer, locate the target underlying implementation function that matches the target local interface, and execute the target underlying implementation function.
[0009] According to another aspect of the present invention, a confined device is provided, the confined device comprising: At least one processor; and a memory communicatively connected to said at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor. The computer program is executed by the at least one processor to enable the at least one processor to execute the local interface declaration and linking method in the application interface layer module as described in any embodiment of the present invention, or to execute the local interface function execution method in the application interface layer as described in any embodiment of the present invention.
[0010] According to another aspect of the present invention, an electronic device is also provided, including the restricted device as described in any embodiment of the present invention.
[0011] According to another aspect of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement the local interface declaration and linking method in the application interface layer module as described in any embodiment of the present invention, or to implement the local interface function execution method in the application interface layer as described in any embodiment of the present invention.
[0012] According to another aspect of the present invention, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the local interface declaration and linking method in the application interface layer module as described in any embodiment of the present invention, or implements the steps of the local interface function execution method in the application interface layer as described in any embodiment of the present invention.
[0013] The technical solution of this invention, through obtaining intermediate files of each application module in the application interface layer; extracting local interface functions identified as local interface attributes from the intermediate files of each application module, and constructing a local interface table based on all local interface functions in the application interface layer; establishing application interface layer links and internal links of the embedded operating system for each intermediate file of the application module based on the global index of each local interface function in the local interface table and the underlying implementation functions in the embedded operating system corresponding to each local interface function, thereby obtaining loadable files for each application module, loading and installing the loadable files of each application module in the application interface layer in the embedded operating system, and obtaining multiple application interfaces of the application interface layer; responding to the call instruction of the target local interface in the application interface layer, locating the target underlying implementation function that matches the target local interface, and executing the target underlying implementation function, effectively solves the problem that the converter cannot effectively identify local interface declaration information in the wasm file. By using the local interface table created by the identified local interfaces, the application interface layer API can be accurately linked with the local methods in the embedded operating system, thereby effectively supporting the coexistence definition of local interfaces and general interfaces in an application interface layer module, improving the running performance of the application interface layer API, and thus effectively improving the running performance of the application.
[0014] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 This is a flowchart illustrating the implementation of application compilation, conversion, loading, and installation for an embedded operating system applicable to the embodiments of the present invention. Figure 2 This is a flowchart of a local interface declaration and linking method in an application interface layer module provided by an embodiment of the present invention; Figure 3 This is a flowchart of another method for declaring and linking local interfaces in an application interface layer module provided in an embodiment of the present invention; Figure 4 This is a flowchart of a method for executing local interface functions in an application interface layer according to an embodiment of the present invention; Figure 5 This is a flowchart of another method for executing local interface functions in the application interface layer provided by an embodiment of the present invention; Figure 6 This is a schematic diagram of the structure of a local interface declaration and linking device in an application interface layer module according to an embodiment of the present invention; Figure 7 This is a schematic diagram of the structure of a local interface function execution device in an application interface layer according to an embodiment of the present invention; Figure 8 This is a schematic diagram of the structure of a controlled device that implements the local interface declaration and linking in the application interface layer module of the present invention, as well as the local interface function execution method in the application interface layer. Figure 9 This is a schematic diagram of the structure of an electronic device provided according to an embodiment of the present invention. Detailed Implementation
[0017] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0018] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0019] To facilitate understanding of the technical solutions of the various embodiments of the present invention, the implementation process of compiling, converting, loading and installing applications applicable to the embedded operating system (i.e., the WebAssembly runtime environment) will be briefly described first.
[0020] Specifically, such as Figure 1As shown, after writing the application source code in a specified programming language (e.g., C, C++, C#, Kotlin, Rust, Python, or Java), compiling the application source code using a compiler yields an application module intermediate file (i.e., a wasm format intermediate file). This application module intermediate file contains the application bytecode. Then, by using a converter to transform the application module intermediate file, configuration files, and linker files, a loadable application module file can be obtained.
[0021] The link file is a link file for the application source code to reference the interface library file. The configuration file contains various configuration information required to convert and generate the loadable application module file, including the unique identifier (also known as AID) of the application module and information on one or more executable modules. The executable module information includes the executable module AID and the installation interface class name or installation interface function name of the executable module.
[0022] Subsequently, using the on-chip installer in the device where the application needs to be installed, the loadable file of the application module can be loaded into the on-chip embedded operating system, generating an executable file for the application module (often simply referred to as the application module). This application module contains one or more executable modules, each containing a unique interface for installing the application. This device is generally a restricted device, which can be understood as a resource-constrained device, referring to a device with very limited hardware resources (such as memory resources). Further, this restricted device can be a smart card, a Secure Element (SE), or an embedded device, etc.
[0023] The application installation process involves the runtime environment within the embedded operating system calling and running the unique installation interface within the application module to create application data and the registry. By installing applications, each executable module can be instantiated into one or more applications.
[0024] In fact, the flowchart for compiling, converting, loading, and installing the application described above also applies to processing the application source code of the application interface layer. The application interface layer is an intermediate abstraction layer between the upper-layer application and the lower-layer embedded operating system. It encapsulates a unified and standardized call entry point (API, library functions, or SDK interfaces, etc.) to the outside world, shielding the implementation details of the underlying hardware and operating system kernel. It serves as a bridge for interaction between the upper-layer application and the lower-layer embedded operating system.
[0025] Specifically, the application source code of the application interface layer is compiled by a compiler to obtain the intermediate file of the application module of the application interface layer. This intermediate file is then converted by a converter to obtain the loadable file of the application module of the application interface layer. After being loaded into the embedded operating system by an installer, the loadable file of the application module of the application interface layer forms the executable file of the application module of the application interface layer (or, it can also be called the application interface layer module). After the application is installed in the embedded operating system, the executable file of the application module of the application interface layer is instantiated as the application interface of the application interface layer for use by upper-layer applications.
[0026] Figure 2 This is a flowchart illustrating a method for declaring and linking local interfaces in an application interface layer module according to an embodiment of the present invention. This embodiment is applicable to situations where the converter accurately identifies each local interface in the intermediate files of each application module in the application interface layer and establishes application interface layer links and embedded operating system internal links for each local interface. This method can be executed by a local interface declaration and linking device in the application interface layer module. This device can be implemented in hardware and / or software and is generally configured in the converter. Figure 2 As shown, the method includes: S210. Obtain the intermediate files of each application module in the application interface layer, wherein each application module intermediate file includes local interface functions for local interface attributes and / or general interface functions for general interface attributes.
[0027] The application module intermediate files (i.e., wasm files) are generated by compiling the application source code of the application interface layer using a compiler. Native interface functions can be understood as functions implemented in an efficient programming language (typically C) and deployed within the embedded operating system, while generic interface functions can be understood as functions implemented in the application interface layer modules using the programming language adapted to those modules. There is a one-to-one correspondence between native interface functions and native interface attributes, and a one-to-one correspondence between generic interface functions and generic interface attributes.
[0028] It's important to note that since the native interface functions are ultimately implemented within the embedded operating system, the application module intermediate file only needs to include key function information (e.g., function name, parameter list, and return value), without containing the actual function implementations. For clarity, the actual function implementations within the embedded operating system are defined as the underlying implementation functions, while the native interface functions in the application module intermediate file can be understood as shell functions used to link to these underlying implementation functions.
[0029] In fact, the application source code for the application interface layer can be written in any programming language. However, because the wasm file format does not contain programming language keywords, when a native interface is declared in the application source code using keywords (or similar keywords), the declaration will not be reflected in the final wasm file.
[0030] In other words, in the existing technology, if the application source code of the application interface layer is written using a programming language that declares local interfaces by keywords (hereinafter referred to as the target programming language), the final application interface layer module will either contain only local interfaces or only general interfaces, and it is impossible to achieve the coexistence of local interfaces and general interfaces in an application interface layer module.
[0031] In this embodiment, a compile-stage native interface forced retention strategy is created for this type of target programming language. An agreement is reached with developers to develop the application source code for the interface layer based on this strategy. Furthermore, by storing all native interface identifiers (e.g., function names) in a specific area within the application source code, the native interface information can be forcibly retained. By introducing this compile-stage native interface forced retention strategy, developers can simultaneously include both native interface functions and generic interface functions within a single application source code when building the application source code for the application interface layer.
[0032] Furthermore, after compiling the source code of each application to obtain intermediate files for each application module, each intermediate file for an application module may include only one or more local interface functions with local interface attributes, only one or more general interface functions with general interface attributes, or both local interface functions with local interface attributes and general interface functions with general interface attributes.
[0033] S220. Extract the local interface functions identified as local interface attributes from the intermediate files of each application module, and construct a local interface table based on all local interface functions in the application interface layer.
[0034] In this embodiment, local interface functions identified as local interface attributes can be extracted from the intermediate files of each application module based on the local interface attributes declared in the source code of each application according to the characteristics of the programming language.
[0035] In an optional implementation of this embodiment, if the target programming language of the target application source code declares local interface attributes for a set interface using keywords, then the compiler-stage local interface forced retention policy based on the pre-agreed terms of the target programming language is obtained; the target data segment is determined according to the compiler-stage local interface forced retention policy; the target data segment is located in the intermediate file of the target application module that matches the target application source code, and the functions recorded in the target data segment are identified as local interface functions.
[0036] Specifically, considering that C language declares interfaces using keywords and has a wider range of applications, the target programming language can include C language. Accordingly, the strategy for forcibly retaining native interfaces during the compilation stage can include: defining the function name declared as a native interface attribute as a character constant and adding the character constant to the target data segment so as to permanently retain the character constant in the target data segment of the intermediate file of the compiled application module.
[0037] In a specific example, developers can build code in the application source code in the form of the following, based on the compiler-stage native interface forced retention policy corresponding to the C language: 1) void setIdMethod (unsigned char id){}; 2) const char native_SetIdMethod[] = "nativeSetIdMethod"; 3)__attribute__((used, section(".nativedata"))) Line 1) defines the return type, function name, and function parameters of the native interface function. Line 2 defines the function name (or function name + parameter list) of the native interface function as a character constant. Line 3 adds the defined character constant to a unified target data segment (nativedata). Through the above settings, the target data segment will be permanently retained in the intermediate file of the application module compiled from the application source code. This is equivalent to retaining the identification information of the native interface after compilation.
[0038] Correspondingly, after the target application source code is compiled into the target application module intermediate file using the compiler, the character constants constructed from native interface functions have already been compiled into the "nativedata" data segment of the target application module intermediate file. Then, the converter takes the target application module intermediate file as input and parses the "nativedata" data segment according to the format rules of the wasm file. It can identify each interface name in the "nativedata" data segment as a native interface name, and then, based on the identified native interface names, it can find the complete interface declaration in the function segment of the target application module intermediate file.
[0039] In another optional implementation of this embodiment, if the programming language of the application source code declares local interface attributes for a set interface through annotations and / or annotations, then the target key information used by the compiler to identify the content of the annotations and / or annotations is obtained; in the intermediate file of the application module that matches the application source code, the function carrying the target key information is identified as a local interface function.
[0040] Of course, it is understandable that if a programming language can declare local interface attributes through annotations or annotations, then after writing the application source code using that programming language and finally compiling it into the application module intermediate file, the identification information of the local interface can be retained in the application module intermediate file, and at this time, the corresponding local interface function can be directly identified.
[0041] It needs to be emphasized again that since the local interface functions are ultimately implemented in the underlying embedded operating system, developers do not need to actually implement the specific interface function code for the local interface functions when developing the application source code of the application interface layer.
[0042] Based on the above embodiments, constructing a local interface table according to all local interface functions in the application interface layer may include: Assign a unique and globally contiguous global index to each local interface function in the application interface layer; associate the function name of each local interface function with its corresponding global index to generate a local interface table.
[0043] In this embodiment, since the application interface layer contains multiple application interface layer modules, the local interface functions in different application interface layer modules may all point to the same underlying implementation function in the embedded operating system. Therefore, it is necessary to establish a corresponding global index in a global local interface table based on all the local interface functions identified in the intermediate files of each application module in the application interface layer, to ultimately ensure the accuracy of subsequent application interface layer linking and embedded operating system internal linking.
[0044] In a specific example, the application module intermediate files in the application interface layer include: application module intermediate file 1, application module intermediate file 2, and application module intermediate file 3. Two native interface functions are identified in application module intermediate file 1, three in application module intermediate file 2, and five in application module intermediate file 3. That is, the application interface layer contains a total of 2 + 3 + 5 = 10 native interface functions.
[0045] Based on this, a global local interface table can be initialized and constructed. The 10 local interface functions in this table are then sequentially numbered from 1 to 10, with each function's number serving as its global index. Finally, the function name and its corresponding global index are associated and stored to generate the final local interface table.
[0046] In a specific example, the data structure of this local interface table can be: {Function name AAA, global index 1;} Function name: BBB, global index: 2; Function name CCC, global index 3; ... Function name JJJ, global index 10; } S230. Based on the global index of each local interface function in the local interface table and the underlying implementation function in the embedded operating system corresponding to each local interface function, establish application interface layer links and embedded operating system internal links for the intermediate files of each application module to obtain the loadable files of each application module.
[0047] In this embodiment, the linking of the local interface includes two parts: the application interface layer link and the internal linking of the embedded operating system. The application interface layer link of the local interface refers to the linking of function call relationships within or outside the application interface layer module, and includes the following: 1. Within the application interface layer module, functions declared as local interfaces are called and linked by other interfaces as entity functions; 2. Outside of the application interface layer module, a function declared as a local interface in one application interface layer module is imported into another application interface layer module and participates in the function call chain of that application interface layer module as an entity function.
[0048] Furthermore, the embedded operating system internal linking of the local interface refers to mapping all functions declared as local interfaces to the low-level implementation functions (typically C language functions) within the embedded operating system.
[0049] In this embodiment, after establishing application interface layer links and embedded operating system internal links for each application module intermediate file, the loadable application module files corresponding to each application module intermediate file can be obtained.
[0050] The technical solution of this invention obtains intermediate files of each application module in the application interface layer; extracts local interface functions identified as local interface attributes from the intermediate files of each application module, and constructs a local interface table based on all local interface functions in the application interface layer; establishes application interface layer links and internal links of the embedded operating system for each intermediate file of the application module based on the global index of each local interface function in the local interface table and the underlying implementation functions in the embedded operating system corresponding to each local interface function, thereby obtaining the loadable files of each application module. This effectively solves the problem that the converter cannot effectively identify local interface declaration information in the wasm file. By using the local interface table created by the identified local interfaces, the application interface layer API can be accurately linked with the local methods in the embedded operating system, thereby effectively supporting the coexistence of local interfaces and general interfaces in an application interface layer module. After loading and installing the above-mentioned loadable files of each application module in the embedded operating system, the running performance of the application interface layer API can be effectively improved, thereby effectively improving the running performance of the application.
[0051] Figure 3 This is a flowchart illustrating another method for declaring and linking local interfaces in an application interface layer module, provided by an embodiment of the present invention. This embodiment is an optimization based on the aforementioned embodiments. Specifically, it details the operation of "establishing application interface layer links and internal links within the embedded operating system for intermediate files of each application module based on the global index of each local interface function in the local interface table and the underlying implementation functions corresponding to each local interface function in the embedded operating system, thereby obtaining loadable files for each application module."
[0052] Correspondingly, such as Figure 3 As shown, this method can specifically include: S310. Obtain the intermediate files of each application module in the application interface layer, wherein each application module intermediate file includes local interface functions for local interface attributes and / or general interface functions for general interface attributes.
[0053] S320. Extract the local interface functions identified as local interface attributes from the intermediate files of each application module, and construct a local interface table based on all local interface functions in the application interface layer.
[0054] S330. Based on the local interface function call relationships within the intermediate files of each application module and / or across intermediate files of application modules, re-establish the application interface layer links according to the global index of the called function in the local interface table.
[0055] In an optional implementation of this embodiment, re-establishing the application interface layer link based on the local interface function call relationships within the intermediate files of each application module and the global index of the called function in the local interface table may include: The process involves sequentially retrieving the current application module's intermediate file from each application module's intermediate file and searching for interface call instructions within that file. If a target module interface call instruction for the first local interface function within the module is found, the first global index of the first local interface function is retrieved from the local interface table. The target module interface call instruction is then bound to the first global index to re-establish the application interface layer link within the module for the first local interface function. The process then returns to the previous steps of sequentially retrieving the current application module's intermediate file from each application module's intermediate file, continuing until all application module intermediate files have been processed.
[0056] In this context, an intra-module interface call instruction can be understood as: within the current application interface layer module that matches the current application module's intermediate file, an instruction for one interface function to call another interface function. An intra-module generic interface function can be understood as: a generic interface function within the current application interface layer module. An intra-module first local interface function can be understood as: a specific local interface function within the current application interface layer module.
[0057] By binding the interface call instruction within the target module to the first global index of the first local interface function in the local interface table, when the general interface function within the module in the intermediate file of the current application module needs to call the first local interface function within the module, it can directly jump to the memory address of the underlying implementation function in the embedded operating system pointed to by the first global index (described in detail below with reference to the function pointer table) to perform the function interface call, so as to ultimately achieve the call to the underlying implementation function in the embedded operating system.
[0058] In another optional implementation of this embodiment, re-establishing the application interface layer link based on the local interface function call relationship across application module intermediate files and the global index of the called function in the local interface table may include: The process involves sequentially retrieving the current application module's intermediate file from each application module's intermediate file and searching for inter-module interface call instructions within it. If it is determined that the general interface function in the current application module's intermediate file targets the inter-module interface call instructions for the second local interface function in other application module's intermediate files, the process retrieves the second global index of the second local interface function from the local interface table. The target inter-module interface call instructions are then bound to the second global index to re-establish the application interface layer link between modules for the second local interface function. Finally, the process returns to retrieving the current application module's intermediate file from each application module's intermediate file, continuing until all application module intermediate files have been processed.
[0059] The inter-module interface call instruction can be understood as: an instruction that calls an interface function within the current application interface layer module, which matches the intermediate file of the current application module, to an interface function within another application interface layer module. The second local interface function can be understood as: a local interface function located within another application interface layer module, which is called by a general interface function within the current application interface layer module.
[0060] By binding the interface call instructions between target modules to the second global index of the second local interface function in the local interface table, when the general interface function in the current application module's intermediate file needs to call the second local interface function in other application module's intermediate file, it can directly jump to the memory address of the underlying implementation function in the embedded operating system pointed to by the second global index (described in detail below with reference to the function pointer table) to perform the function interface call, so as to ultimately achieve the call to the underlying implementation function in the embedded operating system.
[0061] S340. Construct a function pointer table based on the local interface table, and fill the function pointer table with the memory pointers of the underlying implementation functions corresponding to each local interface function in the embedded operating system.
[0062] As mentioned earlier, the S330 has already linked the calls to local interface functions within and between application interface layer modules to the matching global indexes in the local interface table. At this point, it is only necessary to establish the links between each global index in the local interface table and the memory pointers of the underlying implementation functions implemented within the embedded operating system.
[0063] Accordingly, in an optional implementation of this embodiment, constructing a function pointer table based on the local interface table and filling the function pointer table with the memory pointers of the underlying implementation functions corresponding to each local interface function in the embedded operating system may include: Using the global index of each local interface function in the local interface table as the array subscript, create an empty array of function pointers as the function pointer table; obtain the memory pointer of the underlying implementation function that matches each local interface function; fill the memory pointer of each underlying implementation function into the array subscript position in the function pointer table that matches the corresponding global index.
[0064] By using the local interface table and the function pointer table in conjunction, after obtaining the global index of a local interface function to be called, the specific array position in the function pointer table can be located based on this global index. Then, at the located array position, the memory pointer of the underlying implementation function that actually needs to be called can be obtained. Finally, by using this memory pointer, the execution of the underlying implementation function can be achieved.
[0065] S350. Write the function information of each local interface function in the local interface table into the function metadata of the corresponding local interface function in the loadable file of each application module, and establish an internal link of the embedded operating system.
[0066] The function information includes the global index of the local interface function in the local interface table, the number of parameters of the local interface function, and the return information of the local interface function.
[0067] The technical solution of this invention, by comprehensively using the local interface table and the function pointer table created based on the local interface table, can accurately establish application interface layer links and embedded operating system internal links for intermediate files of each application module. This achieves efficient linking of application interface layer modules that define local interfaces and general interfaces in a way that effectively improves the running performance of application interface layer APIs.
[0068] Based on the above embodiments, after constructing the local interface table according to all local interface functions in the application interface layer, it may further include: Delete the function entity code of each local interface function in the intermediate files of each application module, and only keep the function metadata of each local interface function.
[0069] As mentioned earlier, since the local interface functions defined in the application module intermediate files are not actually used during program execution, the function entity code of each local interface function in each application module intermediate file can be deleted after the local interface table is built, and only the function metadata of each local interface function can be retained. Through the above settings, the space overhead of the subsequently generated application module loadable files can be effectively saved, which improves the performance of the application interface layer API to a certain extent.
[0070] Figure 4This is a flowchart illustrating a method for executing local interface functions in an application interface layer according to an embodiment of the present invention. This embodiment is applicable to situations where, after loading and installing loadable files of various application modules in the application interface layer into an embedded operating system, and obtaining multiple application interfaces in the application interface layer, calls to local interfaces in the application interface layer are directly linked to the underlying implementation functions in the embedded operating system. This method can be executed by a local interface function execution device in the application interface layer. This device can be implemented in hardware and / or software and is generally configurable within the embedded operating system. Figure 4 As shown, the method includes: S410. Load and install the loadable files of each application module in the application interface layer in the embedded operating system to obtain multiple application interfaces of the application interface layer.
[0071] Each application interface includes a local interface for linking to the underlying implementation functions in the embedded operating system, and / or a general interface for linking to general functions in the application interface layer.
[0072] In this embodiment, the loadable files of each application module are constructed using the local interface declaration and linking method in the application interface layer module as described in any embodiment of the present invention. That is, the loadable files of the application modules are obtained by converting the intermediate files of each application module in the application interface layer through a converter, and the intermediate files of the application modules are generated by compiling the application source code of the application interface layer using a compiler. Each intermediate file of the application modules includes local interface functions with local interface attributes and / or general interface functions with general interface attributes.
[0073] Based on the above embodiments, while loading and installing the loadable files of each application module in the application interface layer in the embedded operating system, the method further includes: Load the local interface table and function pointer table that match the loadable files of each application module in the embedded operating system; The local interface table records the global index of each local interface function corresponding to each underlying implementation function in the embedded operating system, while the function pointer table records the memory pointer of each underlying implementation function.
[0074] Specifically, the local interface table records the function names of each local interface function declared in the loadable files of each application module, as well as the global index corresponding to each local interface function. Each local interface function uniquely corresponds to a low-level implementation function in the embedded operating system; different local interface functions may correspond to the same or different low-level implementation functions in the embedded operating system.
[0075] S420: In response to the call instruction for the target local interface in the application interface layer, locate the target underlying implementation function that matches the target local interface and execute the target underlying implementation function.
[0076] In this embodiment, the target underlying implementation function that matches the target local interface in the application interface layer that needs to be called can be accurately determined based on the local interface table and the function pointer table, thereby enabling efficient execution of the target underlying implementation function.
[0077] The technical solution of this invention loads and installs the loadable files of each application module in the application interface layer in the embedded operating system to obtain multiple application interfaces of the application interface layer; in response to the call instruction of the target local interface in the application interface layer, it locates the target underlying implementation function that matches the target local interface and executes the target underlying implementation function. Based on the application interface layer module that defines the coexistence of local interfaces and general interfaces and the internal linking of the embedded operating system, it realizes the flexible calling of any local interface in the application interface layer of the embedded operating system, which greatly improves the running performance of the application interface layer API, thereby effectively improving the running performance of the application.
[0078] Figure 5 This is a flowchart of another method for executing local interface functions in the application interface layer provided by an embodiment of the present invention. This embodiment is based on the above embodiments and is optimized. In this embodiment, the operation of "in response to the call instruction of the target local interface in the application interface layer, locating the target underlying implementation function that matches the target local interface and executing the target underlying implementation function" is specifically specified.
[0079] Correspondingly, such as Figure 5 As shown, the method may specifically include: S510: Load and install the loadable files of each application module in the application interface layer in the embedded operating system to obtain multiple application interfaces of the application interface layer.
[0080] Each application interface includes a local interface for linking to the underlying implementation functions in the embedded operating system, and / or a general interface for linking to general functions in the application interface layer.
[0081] S520: Load the local interface table and function pointer table that match the loadable files of each application module in the embedded operating system.
[0082] The local interface table records the global index of each local interface function corresponding to each underlying implementation function in the embedded operating system, while the function pointer table records the memory pointer of each underlying implementation function.
[0083] S530, In response to a call instruction to the target local interface in the application interface layer, obtain the target global index of the target local interface function that matches the target local interface in the local interface table.
[0084] In an optional implementation of this embodiment, in response to a call instruction to a target local interface in the application interface layer, obtaining the target global index of the target local interface function matching the target local interface in the local interface table may include: In response to a call instruction to the target local interface in the application interface layer, obtain the target function identification information of the target local interface function that matches the target local interface; After loading and installing the loadable files of each application module, obtain the target function metadata that matches the target function identifier information from the function metadata obtained; In the target function metadata, obtain the target local interface function's target global index in the local interface table.
[0085] Among them, the function metadata that matches each local interface function contains the function information of the local interface function. Specifically, the function information includes the global index of the local interface function in the local interface table, the number of parameters of the local interface function, and the return information of the local interface function.
[0086] S540. Based on the target global index, query the function pointer table to obtain the target memory pointer of the target underlying implementation function that matches the target local interface function.
[0087] Optionally, in the function pointer table, a function pointer array is constructed using the global index of each local interface function in the local interface table as the array subscript, and the memory pointers of the underlying implementation functions matched by each local interface function are filled into the matching array subscript positions in the function pointer array.
[0088] Accordingly, based on the target global index, the function pointer table is queried to obtain the target memory pointer of the target underlying implementation function that matches the target native interface function. This can specifically include: Based on the target global index, construct the target array subscript; in the function pointer table, obtain the array value that matches the target array subscript, and use it as the target memory pointer of the target underlying implementation function.
[0089] S550: Based on the target memory pointer, locate and execute the target underlying implementation function in the embedded operating system.
[0090] The technical solution of this invention is based on the application interface layer module that defines the coexistence of local interfaces and general interfaces, which completes the application interface layer link and the internal link of the embedded operating system. This enables flexible calling of any local interface in the application interface layer of the embedded operating system, greatly improving the running performance of the application interface layer API, thereby effectively improving the running performance of the application.
[0091] Figure 6 This is a schematic diagram of the structure of a local interface declaration and linking device in an application interface layer module according to an embodiment of the present invention. The local interface declaration and linking device is configured in a converter, such as... Figure 6 As shown, the device includes: an intermediate file acquisition module 610, a local interface table construction module 620, and a link establishment module 630, wherein: The intermediate file acquisition module 610 is used to acquire the intermediate files of each application module in the application interface layer. The intermediate files of each application module include local interface functions of local interface attributes and / or general interface functions of general interface attributes. The local interface table construction module 620 is used to extract local interface functions identified as local interface attributes from the intermediate files of each application module, and construct a local interface table based on all local interface functions in the application interface layer. The link establishment module 630 is used to establish application interface layer links and embedded operating system internal links for the intermediate files of each application module based on the global index of each local interface function in the local interface table and the underlying implementation functions in the embedded operating system corresponding to each local interface function, so as to obtain the loadable files of each application module.
[0092] The technical solution of this invention obtains intermediate files of each application module in the application interface layer; extracts local interface functions identified as local interface attributes from the intermediate files of each application module, and constructs a local interface table based on all local interface functions in the application interface layer; establishes application interface layer links and internal links of the embedded operating system for each intermediate file of the application module based on the global index of each local interface function in the local interface table and the underlying implementation functions in the embedded operating system corresponding to each local interface function, thereby obtaining the loadable files of each application module. This effectively solves the problem that the converter cannot effectively identify local interface declaration information in the wasm file. By using the local interface table created by the identified local interfaces, the application interface layer API can be accurately linked with the local methods in the embedded operating system, thereby effectively supporting the coexistence of local interfaces and general interfaces in an application interface layer module. After loading and installing the above-mentioned loadable files of each application module in the embedded operating system, the running performance of the application interface layer API can be effectively improved, thereby effectively improving the running performance of the application.
[0093] Based on the above embodiments, the application module intermediate file is generated by compiling the application source code of the application interface layer using a compiler; Correspondingly, the local interface table construction module 620 can be specifically used for: Based on the local interface attributes declared in the source code of each application according to the characteristics of the programming language, the local interface functions identified as local interface attributes are extracted from the intermediate files of each application module.
[0094] Based on the above embodiments, the local interface table construction module 620 can be further used for: If the target programming language of the target application source code declares local interface attributes for a specified interface using keywords, then the compiler-stage local interface forced retention strategy, which is pre-agreed upon by the target programming language, is obtained. The target data segment is determined based on the local interface forced retention policy during the compilation phase; In the intermediate file of the target application module that matches the source code of the target application, locate the target data segment and identify the functions recorded in the target data segment as local interface functions.
[0095] Based on the above embodiments, the target programming language may include C language, and the strategy for forcibly retaining the local interface during the compilation stage may include: defining the function name declared as a local interface attribute as a character constant, and adding the character constant to the target data segment so as to permanently retain the character constant in the target data segment of the intermediate file of the compiled application module.
[0096] Based on the above embodiments, the link establishment module 630 may specifically include: The application interface layer linking unit is used to re-establish the application interface layer link based on the local interface function call relationship within the intermediate files of each application module and / or across intermediate files of application modules, according to the global index of the called function in the local interface table. The function pointer table generation unit is used to construct a function pointer table based on the local interface table, and fill the memory pointers of the underlying implementation functions corresponding to each local interface function in the embedded operating system into the function pointer table; The embedded operating system internal link unit is used to write the function information of each local interface function in the local interface table into the function metadata of the corresponding local interface function in the loadable file of each application module, thereby establishing the internal link of the embedded operating system. The function information includes the global index of the local interface function in the local interface table, the number of parameters of the local interface function, and the return information of the local interface function.
[0097] Based on the above embodiments, the local interface table construction module 620 can be specifically used for: Assign a unique and globally contiguous global index to each local interface function in the application interface layer; The function names of each local interface function are associated with their corresponding global indexes to generate a local interface table.
[0098] Based on the above embodiments, the application interface layer link unit can be specifically used for: In each application module intermediate file, the current application module intermediate file is obtained sequentially, and the interface call instructions within the module are searched in the current application module intermediate file. If a target module interface call instruction for the first local interface function within the module is found to be a general interface function within the module, then the first global index of the first local interface function is obtained from the local interface table. Bind the interface call instructions within the target module to the first global index to re-establish the application interface layer link within the module for the first local interface function; Return to the previous step and execute the operation of retrieving the intermediate file of the current application module in turn, until the processing of all application module intermediate files is completed.
[0099] Based on the above embodiments, the application interface layer link unit can be further specifically used for: In each application module intermediate file, the current application module intermediate file is obtained sequentially, and the inter-module interface call instructions are searched in the current application module intermediate file; If it is determined that the general interface function in the current application module intermediate file is the target module inter-module interface call instruction for the second local interface function in other application module intermediate files, then the second global index of the second local interface function is obtained in the local interface table. Bind the target module inter-module interface call instructions to the second global index to re-establish the application interface layer link between modules for the second local interface function; Return to the previous step and execute the operation of retrieving the intermediate file of the current application module in turn, until the processing of all application module intermediate files is completed.
[0100] Based on the above embodiments, the function pointer table generation unit can be specifically used for: Using the global index of each local interface function in the local interface table as the array subscript, create an empty array of function pointers as the function pointer table; Obtain the memory pointer of the underlying implementation function that matches each local interface function; Fill the memory pointers of each underlying implementation function into the array index position in the function pointer table that matches the corresponding global index.
[0101] Based on the above embodiments, a function entity code deletion module may also be included, used for: After constructing the local interface table based on all local interface functions in the application interface layer, delete the function entity code of each local interface function in the intermediate files of each application module, and only retain the function metadata of each local interface function.
[0102] The local interface declaration and linking device in the application interface layer module provided in the embodiments of the present invention can execute the local interface declaration and linking method in the application interface layer module provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0103] Figure 7 This is a schematic diagram of a local interface function execution device in an application interface layer according to an embodiment of the present invention. The local interface function execution device is configured in an embedded operating system. The device includes: an application interface installation module 710 and a local interface calling module 720, wherein: Application interface installation module 710 is used to load and install the loadable files of each application module in the application interface layer in the embedded operating system, so as to obtain multiple application interfaces of the application interface layer. Each application interface includes a local interface for linking to the underlying implementation functions in the embedded operating system, and / or a general interface for linking to general functions in the application interface layer. The local interface invocation module 720 is used to respond to the invocation instruction of the target local interface in the application interface layer, locate the target underlying implementation function that matches the target local interface, and execute the target underlying implementation function.
[0104] The technical solution of this invention loads and installs the loadable files of each application module in the application interface layer in the embedded operating system to obtain multiple application interfaces of the application interface layer; in response to the call instruction of the target local interface in the application interface layer, it locates the target underlying implementation function that matches the target local interface and executes the target underlying implementation function. Based on the application interface layer module that defines the coexistence of local interfaces and general interfaces and the internal linking of the embedded operating system, it realizes the flexible calling of any local interface in the application interface layer of the embedded operating system, which greatly improves the running performance of the application interface layer API, thereby effectively improving the running performance of the application.
[0105] Based on the above embodiments, the device may further include: a key information table loading module, used for: While loading and installing the loadable files of each application module in the application interface layer in the embedded operating system, the local interface table and function pointer table that match the loadable files of each application module are also loaded in the embedded operating system. The local interface table records the global index of each local interface function corresponding to each underlying implementation function in the embedded operating system, while the function pointer table records the memory pointer of each underlying implementation function.
[0106] Based on the above embodiments, the local interface call module 720 may specifically include: The global index acquisition unit is used to retrieve the target global index of the target local interface function that matches the target local interface in the local interface table in response to the call instruction of the target local interface in the application interface layer. The memory pointer acquisition unit is used to query the function pointer table based on the target global index and obtain the target memory pointer of the target underlying implementation function that matches the target local interface function. The underlying implementation function execution unit is used to locate and execute the target underlying implementation function in the embedded operating system based on the target memory pointer.
[0107] Based on the above embodiments, the global index acquisition unit can be specifically used for: In response to a call instruction to the target local interface in the application interface layer, obtain the target function identification information of the target local interface function that matches the target local interface; After loading and installing the loadable files of each application module, obtain the target function metadata that matches the target function identifier information from the function metadata obtained; In the target function metadata, obtain the target local interface function's target global index in the local interface table.
[0108] Based on the above embodiments, in the function pointer table, a function pointer array is constructed by using the global index of each local interface function in the local interface table as the array subscript, and the memory pointer of the underlying implementation function matched by each local interface function is filled into the matching array subscript position in the function pointer array; Correspondingly, the memory pointer acquisition unit can be further used for: Construct the target array index based on the target global index; In the function pointer table, the array value that matches the target array index is obtained and used as the target memory pointer of the target underlying implementation function.
[0109] The local interface function execution device in the application interface layer provided in the embodiments of the present invention can execute the local interface function execution method in the application interface layer provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0110] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0111] Figure 8 A schematic diagram of a limited device 10 that can be used to implement embodiments of the present invention is shown. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the invention described and / or claimed herein.
[0112] like Figure 8 As shown, the restricted device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from storage unit 16. The RAM 13 may also store various programs and data required for the operation of the restricted device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0113] The I / O interface 15 in the restricted device 10 may include eSPI (Enhanced Serial Peripheral Interface) and SPI (Serial Peripheral Interface), etc.
[0114] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as performing local interface declarations and links in the application interface layer module as described in the various embodiments of the present invention, and local interface function execution methods in the application interface layer.
[0115] The local interface declaration and linking method in the application interface layer module includes: obtaining intermediate files of each application module in the application interface layer, wherein each intermediate file of the application module includes local interface functions with local interface attributes and / or general interface functions with general interface attributes; extracting local interface functions identified as local interface attributes from each intermediate file of the application module, and constructing a local interface table based on all local interface functions in the application interface layer; establishing application interface layer links and internal links of the embedded operating system for each intermediate file of the application module based on the global index of each local interface function in the local interface table and the underlying implementation functions in the embedded operating system corresponding to each local interface function, thereby obtaining the loadable files of each application module.
[0116] The method for executing local interface functions in the application interface layer includes: loading and installing loadable files of each application module in the application interface layer in the embedded operating system to obtain multiple application interfaces of the application interface layer; wherein, each application interface includes a local interface for linking to the underlying implementation functions in the embedded operating system, and / or a general interface for linking to general functions in the application interface layer; in response to a call instruction to a target local interface in the application interface layer, locating the target underlying implementation function that matches the target local interface, and executing the target underlying implementation function.
[0117] In some embodiments, the local interface declaration and linking in the application interface layer module and the local interface function execution method in the application interface layer, as described in the various embodiments of the present invention, can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 16. In some embodiments, part or all of the computer program can be loaded and / or installed on the restricted device 10 via ROM 12. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the local interface declaration and linking in the application interface layer module and the local interface function execution method in the application interface layer, as described above in the various embodiments of the present invention, can be performed. Alternatively, in other embodiments, processor 11 can be configured by any other suitable means (e.g., by means of firmware) to perform the local interface declaration and linking in the application interface layer module and the local interface function execution method in the application interface layer, as described in the various embodiments of the present invention.
[0118] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0119] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0120] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0121] Figure 9 This is a structural diagram of an electronic device provided according to an embodiment of the present invention. Figure 9 The electronic device includes the restricted device 910 as described in any embodiment of the present invention.
[0122] The restricted device can be understood as a resource-restricted device, which can typically be a smart card, USB key, ESAM (Embedded Secure Access Module), or SE (Secure Element), etc. The smart card in question is generally a multi-application smart card.
[0123] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0124] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for declaring and linking local interfaces in an application interface layer module, characterized in that, Performed by the converter, the method includes: Obtain the intermediate files of each application module in the application interface layer. Each application module intermediate file includes local interface functions for local interface attributes and / or general interface functions for general interface attributes. Extract the local interface functions identified as local interface attributes from the intermediate files of each application module, and construct a local interface table based on all local interface functions in the application interface layer. Based on the global index of each local interface function in the local interface table, and the underlying implementation functions in the embedded operating system corresponding to each local interface function, application interface layer links and internal links of the embedded operating system are established for the intermediate files of each application module, thus obtaining the loadable files of each application module.
2. The method according to claim 1, characterized in that, Application module intermediate files are generated by compiling the application source code of the application interface layer using a compiler. Accordingly, local interface functions identified as local interface attributes are extracted from the intermediate files of each application module, including: Based on the local interface attributes declared in the source code of each application according to the characteristics of the programming language, the local interface functions identified as local interface attributes are extracted from the intermediate files of each application module.
3. The method according to claim 2, characterized in that, Based on the local interface attributes declared in the source code of each application according to the characteristics of the programming language, the local interface functions identified as local interface attributes are extracted from the intermediate files of each application module. Specifically, these include: If the target programming language of the target application source code declares local interface attributes for a specified interface using keywords, then the compiler-stage local interface forced retention strategy, which is pre-agreed upon by the target programming language, is obtained. The target data segment is determined based on the local interface forced retention policy during the compilation phase; In the intermediate file of the target application module that matches the source code of the target application, locate the target data segment and identify the functions recorded in the target data segment as local interface functions.
4. The method according to claim 3, characterized in that, The target programming language includes C. The strategy for forcibly preserving native interfaces during the compilation phase includes defining the function name declared as a native interface attribute as a character constant and adding the character constant to the target data segment so that the character constant is permanently preserved in the target data segment of the intermediate file of the compiled application module.
5. The method according to any one of claims 1-4, characterized in that, Based on the global index of each local interface function in the local interface table, and the corresponding underlying implementation functions in the embedded operating system, application interface layer links and embedded operating system internal links are established for the intermediate files of each application module, resulting in the loadable files for each application module, including: Based on the local interface function call relationships within the intermediate files of each application module and / or across intermediate files of application modules, the application interface layer links are re-established according to the global index of the called function in the local interface table. A function pointer table is constructed based on the local interface table, and the memory pointers of the underlying implementation functions corresponding to each local interface function in the embedded operating system are filled into the function pointer table. Write the function information of each local interface function in the local interface table into the function metadata of the corresponding local interface function in the loadable file of each application module, and establish an internal link within the embedded operating system. The function information includes the global index of the local interface function in the local interface table, the number of parameters of the local interface function, and the return information of the local interface function.
6. The method according to claim 1, characterized in that, Based on all local interface functions in the application interface layer, construct a local interface table, including: Assign a unique and globally contiguous global index to each local interface function in the application interface layer; The function names of each local interface function are associated with their corresponding global indexes to generate a local interface table.
7. The method according to claim 5, characterized in that, Based on the local interface function call relationships within the intermediate files of each application module, the application interface layer links are re-established according to the global index of the called function in the local interface table, including: In each application module intermediate file, the current application module intermediate file is obtained sequentially, and the interface call instructions within the module are searched in the current application module intermediate file. If a target module interface call instruction for the first local interface function within the module is found to be a general interface function within the module, then the first global index of the first local interface function is obtained from the local interface table. Bind the interface call instructions within the target module to the first global index to re-establish the application interface layer link within the module for the first local interface function; Return to the previous step and execute the operation of retrieving the intermediate file of the current application module in turn, until the processing of all application module intermediate files is completed.
8. The method according to claim 5, characterized in that, Based on the local interface function call relationships of the cross-application module intermediate files, the application interface layer links are re-established according to the global index of the called function in the local interface table, including: In each application module intermediate file, the current application module intermediate file is obtained sequentially, and the inter-module interface call instructions are searched in the current application module intermediate file; If it is determined that the general interface function in the current application module intermediate file is the target module inter-module interface call instruction for the second local interface function in other application module intermediate files, then the second global index of the second local interface function is obtained in the local interface table. Bind the target module inter-module interface call instructions to the second global index to re-establish the application interface layer link between modules for the second local interface function; Return to the previous step and execute the operation of retrieving the intermediate file of the current application module in turn, until the processing of all application module intermediate files is completed.
9. The method according to claim 5, characterized in that, A function pointer table is constructed based on the local interface table, and the memory pointers of the underlying implementation functions corresponding to each local interface function in the embedded operating system are filled into the function pointer table, including: Using the global index of each local interface function in the local interface table as the array subscript, create an empty array of function pointers as the function pointer table; Obtain the memory pointer of the underlying implementation function that matches each local interface function; Fill the memory pointers of each underlying implementation function into the array index position in the function pointer table that matches the corresponding global index.
10. The method according to claim 1, characterized in that, After constructing the local interface table based on all local interface functions in the application interface layer, the following is also included: Delete the function entity code of each local interface function in the intermediate files of each application module, and only keep the function metadata of each local interface function.
11. A method for executing local interface functions in an application interface layer, executed by an embedded operating system, characterized in that, The method includes: Load and install the loadable files of each application module in the application interface layer in the embedded operating system to obtain multiple application interfaces of the application interface layer. Each application interface includes a local interface for linking to the underlying implementation functions in the embedded operating system, and / or a general interface for linking to general functions in the application interface layer. In response to a call instruction to the target local interface in the application interface layer, locate the target underlying implementation function that matches the target local interface and execute the target underlying implementation function.
12. The method according to claim 11, characterized in that, In the embedded operating system, loading and installing the loadable files of each application module in the application interface layer also includes: Load the local interface table and function pointer table that match the loadable files of each application module in the embedded operating system; The local interface table records the global index of each local interface function corresponding to each underlying implementation function in the embedded operating system, while the function pointer table records the memory pointer of each underlying implementation function.
13. The method according to claim 12, characterized in that, In response to a call instruction to a target native interface in the application interface layer, locate the target underlying implementation function that matches the target native interface and execute the target underlying implementation function, including: In response to a call instruction to the target local interface in the application interface layer, obtain the target global index of the target local interface function that matches the target local interface in the local interface table; Based on the target global index, query the function pointer table to obtain the target memory pointer of the target underlying implementation function that matches the target local interface function; Based on the target memory pointer, locate and execute the target underlying implementation function in the embedded operating system.
14. The method according to claim 13, characterized in that, In response to a call instruction to a target local interface in the application interface layer, obtain the target global index of the target local interface function matching the target local interface in the local interface table, including: In response to a call instruction to the target local interface in the application interface layer, obtain the target function identification information of the target local interface function that matches the target local interface; After loading and installing the loadable files of each application module, obtain the target function metadata that matches the target function identifier information from the function metadata obtained; In the target function metadata, obtain the target local interface function's target global index in the local interface table.
15. The method according to claim 13, characterized in that, In the function pointer table, a function pointer array is constructed using the global index of each local interface function in the local interface table as the array subscript, and the memory pointer of the underlying implementation function matched by each local interface function is filled into the matching array subscript position in the function pointer array; Accordingly, based on the target global index, the function pointer table is queried to obtain the target memory pointer of the target underlying implementation function that matches the target native interface function, specifically including: Construct the target array index based on the target global index; In the function pointer table, the array value that matches the target array index is obtained and used as the target memory pointer of the target underlying implementation function.
16. A local interface declaration and linking device in an application interface layer module, characterized in that, Configured in the converter, the device includes: The intermediate file acquisition module is used to acquire the intermediate files of each application module in the application interface layer. Each application module's intermediate file includes local interface functions for local interface attributes and / or general interface functions for general interface attributes. The local interface table construction module is used to extract local interface functions identified as local interface attributes from the intermediate files of each application module, and construct the local interface table based on all local interface functions in the application interface layer. The link establishment module is used to establish application interface layer links and embedded operating system internal links for the intermediate files of each application module based on the global index of each local interface function in the local interface table and the underlying implementation functions in the embedded operating system corresponding to each local interface function, so as to obtain the loadable files of each application module.
17. A local interface function execution device in an application interface layer, configured in an embedded operating system, characterized in that, The device includes: The application interface installation module is used to load and install the loadable files of each application module in the application interface layer in the embedded operating system, thereby obtaining multiple application interfaces of the application interface layer. Each application interface includes a local interface for linking to the underlying implementation functions in the embedded operating system, and / or a general interface for linking to general functions in the application interface layer. The local interface invocation module is used to respond to invocation instructions for the target local interface in the application interface layer, locate the target underlying implementation function that matches the target local interface, and execute the target underlying implementation function.
18. A restricted device, characterized in that, The restricted device includes: At least one processor; and a memory communicatively connected to said at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the local interface declaration and linking method in the application interface layer module of any one of claims 1-10, or to execute the local interface function execution method in the application interface layer of any one of claims 11-15.
19. An electronic device, characterized in that, Including the restricted device as described in claim 18.
20. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the local interface declaration and linking method in the application interface layer module of any one of claims 1-10, or the local interface function execution method in the application interface layer of any one of claims 11-15.
21. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the local interface declaration and linking method in the application interface layer module according to any one of claims 1-10, or implements the local interface function execution method in the application interface layer according to any one of claims 11-15.