CPC G06F 8/71 (2013.01) [G06F 9/445 (2013.01); G06F 16/148 (2019.01); G06F 16/176 (2019.01)] | 22 Claims |
1. An electronic device that executes an application that has a dependency on a shared library, the shared library having a dependency on a runtime component, the electronic device comprising:
a storage device with a file system that includes a plurality of directories; and
a processor configured to execute the application, the executing including:
loading the shared library, the loading including:
executing a constructor for the shared library, the constructor causing the processor to identify a selected directory where a compatible version of the runtime component is to be found based on a location of the shared library in the file system, wherein the location of the shared library is determined from an application context from the application, and wherein the identifying includes:
determining a path of the shared library in the file system from the application context of the application;
identifying candidate directories in the file system where a compatible version of the runtime component may be located based at least in part on the path;
finding, using the candidate directories, the selected directory where the compatible version of the runtime component is located; and
configuring a record in an internal state of the shared library to identify the selected directory as being where the compatible version of the runtime component is located; and
when subsequently loading the compatible version of the runtime component for execution, locate the compatible version of the runtime component in the selected directory.
|