Nick Hodapp
June 15th, 1999, 10:15 AM
I recently sent the following question to Dr. GUI, but thought I'd post it here as well.
I have a simple property sheet shell-extension that uses some of the newer common-control style-bits available in 4.71 of comctl32.dll. Because of this I #define _WIN32_IE=0x400 so that the appropriate definitions are made visible to the compiler when I #include commctrl.h. I also #include shlobj.h, because I require the definitions for the IShellExtInit and IShellPropSheetExt interfaces. Unfortunately, as a result of _WIN32_IE=0x400, my .dll becomes dependent on version 4.71 of shell32.dll, which is undesirable because shell32.dll may not be redistributed by mere mortals.
To fix this I #undef _WIN32_IE after I #include commctrl.h and re-#define it as =0x200 before sucking in shlobj.h. This seems to work fine, as my dll is then dependent on version 4.71 of comctl32.dll and 4.0 of shell32.dll. (Anyone can redistrubute comctl32.dll via 40comupd.exe).
But I do not fully understand what is happening. Why does my .dll become dependent on a particular version of shell32.dll if it doesn't use services of that .dll other than what is available in all versions? The best I can determine is that shlobj.h and commctrl.h use __declspec(dllimport) for all of the functions to be prototyped for the defined _WIN32_IE version. It seems that any function that is prototyped with __declspec(dllimport) becomes a dependency even though I never call that function from my code (and dumpbin does not list these functions as imported).
Can anyone help clear this up for me?
Regards,
Nick Hodapp
I have a simple property sheet shell-extension that uses some of the newer common-control style-bits available in 4.71 of comctl32.dll. Because of this I #define _WIN32_IE=0x400 so that the appropriate definitions are made visible to the compiler when I #include commctrl.h. I also #include shlobj.h, because I require the definitions for the IShellExtInit and IShellPropSheetExt interfaces. Unfortunately, as a result of _WIN32_IE=0x400, my .dll becomes dependent on version 4.71 of shell32.dll, which is undesirable because shell32.dll may not be redistributed by mere mortals.
To fix this I #undef _WIN32_IE after I #include commctrl.h and re-#define it as =0x200 before sucking in shlobj.h. This seems to work fine, as my dll is then dependent on version 4.71 of comctl32.dll and 4.0 of shell32.dll. (Anyone can redistrubute comctl32.dll via 40comupd.exe).
But I do not fully understand what is happening. Why does my .dll become dependent on a particular version of shell32.dll if it doesn't use services of that .dll other than what is available in all versions? The best I can determine is that shlobj.h and commctrl.h use __declspec(dllimport) for all of the functions to be prototyped for the defined _WIN32_IE version. It seems that any function that is prototyped with __declspec(dllimport) becomes a dependency even though I never call that function from my code (and dumpbin does not list these functions as imported).
Can anyone help clear this up for me?
Regards,
Nick Hodapp