COM dll that uses Windows7 libraries on XP
-
I am at a loss and I am hoping someone can lead me down the right path. I have a COM dll that is written in C++. If a user is on Windows7 (or higher), the user will have the option of invoking this new functionality. Otherwise, it will not be available. The problem is that this new functionality uses specific libraries that are only available with Windows7. I didn't think it was a problem until I went to register the DLL on a XP box, where the registration fails. I am certain it is because of these libraries (which are in the project settings). Is there any way to make the DLLS conditional? I have been looking for some different methods but I haven't located anything.
-
I am at a loss and I am hoping someone can lead me down the right path. I have a COM dll that is written in C++. If a user is on Windows7 (or higher), the user will have the option of invoking this new functionality. Otherwise, it will not be available. The problem is that this new functionality uses specific libraries that are only available with Windows7. I didn't think it was a problem until I went to register the DLL on a XP box, where the registration fails. I am certain it is because of these libraries (which are in the project settings). Is there any way to make the DLLS conditional? I have been looking for some different methods but I haven't located anything.
You can try using the "delay load" functionality of the linker for the dependent Win7 DLLs. If that doesn't work, you will need to LoadLibrary()[^] them, and use GetProcAddress()[^]
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun -
You can try using the "delay load" functionality of the linker for the dependent Win7 DLLs. If that doesn't work, you will need to LoadLibrary()[^] them, and use GetProcAddress()[^]
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von BraunAh, loadlibrary, it never even occurred to me. I have used it for DLLs but I have never tried it for libraries. I will give that a try.
-
Ah, loadlibrary, it never even occurred to me. I have used it for DLLs but I have never tried it for libraries. I will give that a try.
If these are static libraries (.LIBs) you're linking to that refer to win7 dlls, then you'll need to put the code that refers to those static libraries into a DLL and then LoadLibrary() those. Also you could detect the OS, and only LoadLibrary() when on Win7 or greater.
If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun -
I am at a loss and I am hoping someone can lead me down the right path. I have a COM dll that is written in C++. If a user is on Windows7 (or higher), the user will have the option of invoking this new functionality. Otherwise, it will not be available. The problem is that this new functionality uses specific libraries that are only available with Windows7. I didn't think it was a problem until I went to register the DLL on a XP box, where the registration fails. I am certain it is because of these libraries (which are in the project settings). Is there any way to make the DLLS conditional? I have been looking for some different methods but I haven't located anything.
Hi, When you compile your COM library you need to #define the appropriate WINVER, _WIN32_WINNT and _WIN32_IE. By setting these values the windows headers will #include or exclude specific functions/libraries. You may receive some compilation errors after setting these values. Do not panic... you will need to use LoadLibrary/GetProcAddress at runtime to determine if the functions are available. Some Win7 features may not be available on WinXP so you may need to re-implement some portions of your application for backwards compatibility. Using the Windows Headers[^] Best Wishes, -David Delaune