Dynamic Link Library Loading via Symbol Index Mapping
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current dynamic loading methods consume excessive resources due to the large memory requirements of character string names in global symbol tables during the dynamic loading process of application programs.
Innovation Solution
A method that involves loading a dynamic link library file, reading an index from a source file, determining the corresponding symbol address in a global symbol table, and invoking the symbol from the dynamic link library file, thereby reducing memory usage by utilizing indices that occupy fewer resources.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If character string names are used in the global symbol table for dynamic loading, then symbol identification accuracy is improved, but memory resource consumption increases
Solution Approach 1:
The patent creates a compact copy of symbol table information by replacing full character string names with integer indices. The global symbol table stores only integer indices instead of complete symbol names, while maintaining the ability to retrieve original symbol names when needed. This copying approach significantly reduces memory consumption while preserving symbol identification functionality.
Solution Approach 2:
The patent changes the data type parameter of symbol table entries from character strings to integer indices. This parameter transformation reduces the memory footprint from variable-length strings to fixed-size integers, directly addressing the memory consumption problem while maintaining the indexing and lookup capabilities needed for accurate symbol identification.
2Quantity of substance
If integer indices are used in the global symbol table, then memory resource consumption is reduced, but symbol lookup complexity increases
Solution Approach 1:
The patent performs preliminary actions by pre-computing and storing the mapping relationships between symbol names and integer indices in the global symbol table during the loading phase. This preliminary organization of data allows for efficient O(1) lookup operations later, as the system only needs to retrieve pre-computed index values rather than performing complex string comparisons during execution.
Solution Approach 2:
The patent introduces an intermediary mechanism - a hash table or mapping structure - that bridges the relationship between integer indices and symbol names. This intermediary layer allows the system to work with compact integer representations during critical path operations while maintaining the ability to resolve full symbol names when needed, thus reducing complexity in the hot path while preserving completeness.
Data Source
AI summary
The application provides a dynamic loading method, and a target file creation method and apparatus to save memory resources. The method includes: loading a dynamic link library file during a running process of an application program on a terminal device, where the dynamic link library file includes a symbol that can implement a functionality in the application program, and the symbol includes a function and/or a variable; reading a first index from a source file of the application program; determining, based on a global symbol table, a first symbol address corresponding to the first index, where the first symbol address is used for indicating a physical address of the symbol that can implement the functionality and invoking the symbol from the dynamic link library file according to the first symbol address, to complete running of the application program.


