title: Creating a simple VS2008 visualizer inside autoexp.dat (problem with casting)
body: <p>I have a large project of mixed C/C++. I've created a simple visualizer for the ICU UnicodeString class as follows...</p>
  
  <pre><code>[inside autoexp.dat]
  icu_4_2::UnicodeString {
          preview     ([$c.fUnion.fFields.fArray,su])
  }
  </code></pre>
  
  <p>...and that works fine. Inside the debugger wherever I see the object I now see the text inside in the preview line.</p>
  
  <p>I then created a wrapper class containing one of these objects as follows...</p>
  
  <pre><code>class StringHandleData
  {
  public:
      icu_4_2::UnicodeString str;
  };
  </code></pre>
  
  <p>...and then created another visualizer for this...</p>
  
  <pre><code>[inside autoexp.dat]
  StringHandleData {
      preview     ([$c.str.fUnion.fFields.fArray,su])
  }
  </code></pre>
  
  <p>...which again, works fine. Whenever I see a StringHandleData object in the debugger I see the text inside in the string.</p>
  
  <p>However, my problem comes when I define a typedef I can use inside C code like this...</p>
  
  <pre><code>typedef void* StringHandle;
  </code></pre>
  
  <p>...which under the hood is actually just a ptr to a StringHandleData object. So when I try and create a visualizer for the StringHandle type like this...</p>
  
  <pre><code>[inside autoexp.dat]
  StringHandle {
      preview     ([((StringHandleData)$c).str.fUnion.fFields.fArray,su])
  }
  </code></pre>
  
  <p>...it doesn't work. I've tried lots of other ways of casting the object too but with no luck so far. If I go to my watch window and cast a StringHandle like this... <strong>(StringHandleData*)stringHandle</strong> then the debugger makes the cast and previews correctly - but I just can't seem to get it to do it automatically from inside autoexp.dat</p>
  
  <p>Thanks for any help.</p>