locked
shell32.lib missing from ARM SDK

    Question

  • I am building a library which I wish to compile in ARM. This library uses CComPtr from atlbase.h, which relies on shell32.lib. This library isn't in the Windows ARM SDK.

    This blog post (http://vincentpovirk.blogspot.co.uk/2012/03/why-im-excited-about-win32-on-arm.html) claims it was in there in the MSVC11 preview, and I was wondering why it had been taken out.

    I am using CComPtr rather than ComPtr for compatibility for our WPF solution which also uses the library (on x86/x64 rather than ARM).

    Friday, November 2, 2012 3:29 PM

Answers

  • Only the lib files containing functions that are available to Windows Store apps (see Win32 and COM API ) are provided.

    Since shell32.lib doesn't provide any functions that can be called by Windows Store apps it isn't provided.

    I don't know why atlbase.h would require it (usually lib files and .h files are separate), but ATL wasn't designed for Windows Store apps and isn't fully compatible. The folks in the ATL forum may know more, but probably haven't looked into this.

    --Rob

    • Marked as answer by D.G.Thomas Monday, November 5, 2012 3:19 PM
    Friday, November 2, 2012 6:04 PM
    Owner
  • The best bet is to make a compile-time solution so that you use ComPtr for Windows Store apps, and you have a Win32 desktop build that uses ATL:CComPtr.

    Depending on your usage, we actually make use of this trick to support both VS 2012 Windows Store apps and VS 2010 Win32 desktop apps for DirectXTK that might work for you.

     #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8 /*0x0602*/) 
     #include <wrl.h>
     #else
     #include <atlbase.h>
    
    
     // Emulate the WRL ComPtr type via ATL CComPtr when building for Windows versions prior to Windows 8.
     namespace Microsoft
     {
         namespace WRL
         {
             template<typename T>
             class ComPtr : public CComPtr<T>
             {
             public:
                 ComPtr() {}
    
    
                 ComPtr(_In_opt_ T* value) : CComPtr(value) {} 
    
    
                 T* Get() const { return *this; }
    
    
                template<typename Q> HRESULT As(_Outptr_ /*_Deref_out_*/ Q** result) const { return QueryInterface(result); }
             };
         }
     }
    
    
     #endif
    

    • Marked as answer by D.G.Thomas Monday, November 5, 2012 3:19 PM
    Friday, November 2, 2012 10:43 PM

All replies

  • Only the lib files containing functions that are available to Windows Store apps (see Win32 and COM API ) are provided.

    Since shell32.lib doesn't provide any functions that can be called by Windows Store apps it isn't provided.

    I don't know why atlbase.h would require it (usually lib files and .h files are separate), but ATL wasn't designed for Windows Store apps and isn't fully compatible. The folks in the ATL forum may know more, but probably haven't looked into this.

    --Rob

    • Marked as answer by D.G.Thomas Monday, November 5, 2012 3:19 PM
    Friday, November 2, 2012 6:04 PM
    Owner
  • The best bet is to make a compile-time solution so that you use ComPtr for Windows Store apps, and you have a Win32 desktop build that uses ATL:CComPtr.

    Depending on your usage, we actually make use of this trick to support both VS 2012 Windows Store apps and VS 2010 Win32 desktop apps for DirectXTK that might work for you.

     #if (_WIN32_WINNT >= _WIN32_WINNT_WIN8 /*0x0602*/) 
     #include <wrl.h>
     #else
     #include <atlbase.h>
    
    
     // Emulate the WRL ComPtr type via ATL CComPtr when building for Windows versions prior to Windows 8.
     namespace Microsoft
     {
         namespace WRL
         {
             template<typename T>
             class ComPtr : public CComPtr<T>
             {
             public:
                 ComPtr() {}
    
    
                 ComPtr(_In_opt_ T* value) : CComPtr(value) {} 
    
    
                 T* Get() const { return *this; }
    
    
                template<typename Q> HRESULT As(_Outptr_ /*_Deref_out_*/ Q** result) const { return QueryInterface(result); }
             };
         }
     }
    
    
     #endif
    

    • Marked as answer by D.G.Thomas Monday, November 5, 2012 3:19 PM
    Friday, November 2, 2012 10:43 PM
  • Much of WRL like ComPtr<> can be used in desktop apps and in code that runs downlevel. I recommend converting use of ATL to WRL when you can.

    Note, there are subtle differences like the behavior of operator&; to avoid leaks WRL releases the pointer held in that case, ATL does not, resulting in a leak when the pointer value is overwritten. Be careful with things like this.

    Chris

    Sunday, November 4, 2012 11:19 PM
  • Cheers Chuck, that seems to work fine.
    Monday, November 5, 2012 3:20 PM