You are not logged in.
Hi all,
I'm trying to write an diagnostic tool for work to run through some debugging diagnostic steps on the target system. It's quite simple idea in that on execution it will gather silicon, system information, read fuses, registers, bootstraps, run basic read/writes to flash/storage, toogle gpios, dump etc. The tool will also run through security api calls, open/close sec devices, calling and testing encrypting/decrypting APIs and testing different drm api calls. However I don't want the main tool to have knowledge of these security api calls, i would like to be able to have helper .so's with knowledge of specific drm api in their corresponding helper .so.
So ideally the tool should somehow dynamically load them by way of a wildcard search of all the helpers .so and execute each as it finds them. I know with dynamically linking in sharedlibs, on execution, if it can't find the specific file a program would error out with message like "libcrypto.so.0.1 doesn't exist" or something like that, which i don't want to happen, I want the tool to continue and execute the rest of the diagnostic tests. The tool should be able to dynamically search and execute whichever .so's that it recognizes and can find since I might have 5 different helper .so for different drm technologies but at any given time they might not exist within the filesystem due to licensing issues for different vendors. Is there a way to do this?
-vincent
Offline
You can use the dl... C functions to load dynamic libraries at runtime. The dynamic loader does this for you when the program starts up but you can do it yourself. For example, in your shared library plugins, you could have common symbols (exported functions) for initializing, performing the test, checking the results, etc. The plugins would themselves link to the required libraries. These third-party libraries would then be loaded and linked automatically. You can set an RPATH in your main program to the plugin directory or use file access functions to search for them and pass absolute paths to dlopen. Or something like that.
dlopen, dlsym, dlerror, dlclose are the C functions you need to load libraries. I found think link on google: http://www.ibm.com/developerworks/linux … index.html. You can use functions like glob and opendir to search for plugin files. glob uses wildcards. I'm assuming you're using C.
Offline
awesome, exactly what i was looking for. Thanks a million juster
Offline