Software Interface for dynamic API mapping
First Claim
1. A method of linking an application comprising an applications program interface (API) having at least one function call with a library set implementing the function, comprising the steps of:
- identifying the libraries required by the API by determining whether the API is in a first program environment or a second program environment wherein;
said API is a TOPEND API, said first program environment is a runtime environment, said second program environment is a remote program environment, and said determining whether the TOPEND API is in a first or second program environment comprises determining if an environment variable is set, wherein said determining if an environment variable is set comprises examining a registry of an operating system hosting a TOPEND runtime or remote environment to determine if a TOPENDDIR entry exists;
scanning to detect and select libraries available to the determined program environment, wherein said scanning to detect and select libraries available to the determined program environment comprises;
setting up a default library, and attempting to load each library in a current library list;
dynamically loading the selected libraries into the application; and
, binding the selected libraries associated API function call.
4 Assignments
0 Petitions
Accused Products
Abstract
A method, apparatus, and article of manufacture for a software interface for dynamic API mapping. The method comprises the steps of identifying the libraries required by the API by determining which program environment the API is operating in, scanning to detect and select libraries available to the determined program environment, dynamically loading the selected libraries, dynamically loading the selected libraries into the application, and binding the selected libraries to the associated API function call.
The present invention allows a single binary application to transparently work with different libraries that provide a common or overlapping API set. This is accomplished by linking the application with a separate library that provides a dynamic API mapping facility. A function in this library is invoked when the application begins execution. The application'"'"'s system is scanned to determine which libraries are available. If more than one choice is available, the dynamic API mapping facility will heuristically determine which library or libraries to use. An environment variable can also be used to force the application to use a specific set of libraries when more than one choice is available. When an appropriate library is determined, it is dynamically loaded into the process, and scanned for each supported API function. When a function is found, a pointer to that function will be bound to a global function pointer named to reflect the corresponding API. Each function pointer has as its default value, a pointer to a default function that returns an appropriate error if called. Once each of the API functions has been mapped, the application can run without the need to be aware of the different libraries to which it is linked. The same binary application can run on a system with any library or set of libraries that provides the appropriate API set.
160 Citations
10 Claims
-
1. A method of linking an application comprising an applications program interface (API) having at least one function call with a library set implementing the function, comprising the steps of:
-
identifying the libraries required by the API by determining whether the API is in a first program environment or a second program environment wherein;
said API is a TOPEND API, said first program environment is a runtime environment, said second program environment is a remote program environment, and said determining whether the TOPEND API is in a first or second program environment comprises determining if an environment variable is set, wherein said determining if an environment variable is set comprises examining a registry of an operating system hosting a TOPEND runtime or remote environment to determine if a TOPENDDIR entry exists;
scanning to detect and select libraries available to the determined program environment, wherein said scanning to detect and select libraries available to the determined program environment comprises;
setting up a default library, and attempting to load each library in a current library list;
dynamically loading the selected libraries into the application; and
,binding the selected libraries associated API function call. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
scanning the library for each API function call; and
binding the address of the function associated with the API function to a globally available function pointer.
-
-
8. The method of claim 7, further comprising the step of setting an address of a function call not found in the scanned library to the address of a second function which returns an error message when called.
-
9. The method according to claim 1, wherein said current library list includes at least one of TOPEND runtime libraries, remote libraries, and user defined libraries.
-
10. The method according to claim 1, wherein said step of attempting comprises:
-
loading and linking each library in an order specified in the library list; and
concluding said loading and linking when one or more functions are successfully mapped.
-
Specification