I am trying to work around a problem with DLL's. I work in a database environment where the SDK calls have changed over the years. I would like one of my applications to work regardless of which software version I am talking to. The problem is that the DLL filenames have changed over the years as new functions have been added. What I need is to make my application "dynamically" call the dynamically-loaded libraries.
The application is in Visual C/C++. I currently have #define's to enable the use of functions only available in newer code, so I have to change the source file to compile for each specific version. Additionally, I *also* have to change the Linker source file of the LIB with which I am linking.
For example, older "v7.5" functions are available in the DLL W3DBAV75.DLL, and I must link with W3DBAV75.LIB. If I want to use some of the newer functions that were added to a more recent version, then I have to change some #defines and change my linker options to use W3DBAV78.LIB, W3DBAV80.LIB, or W3DBAV90.LIB, which changes my DLL to the corresponding DLL, too. I then recompile and I have a new release.
Of course, since I have to change #defines and Links and recompile, I have to post multiple versions of my application, too, so that users who have a newer version of the environment can use the newer features, while users who have an older environment still find the tool functional. This gets confusing for the end users, who are not always experts in renaming EXE files (or reading documentation, for that matter).
What I would LIKE to do is to figure out how to get this to work automatically. Essentially, the application can make a call to query the database environment version FIRST, then intelligently determine the exact DLL that needs to be called at runtime. Obviously, the code would know which version of the DLL was loaded so that it would only call "valid" functions for the given version of the DLL to avoid any crashes or bad memory references.
Is this level of intelligence even possible in Visual C/C++? If so, how?