title: How can I overcome the "error C2100: illegal indirection" when accessing the contents of a void* in VS2008
body: <p>I have a C application that I've created in VS2008. I am creating a mock creation function that overrides function references in a struct. However if I try and do this in a straight forward fashion with something like:</p>
  
  <pre><code>void *ptr = &amp;(*env)-&gt;GetVersion;
  *ptr = &lt;address of new function&gt;
  </code></pre>
  
  <p>then I get a "error C2100: illegal indirection" error as *ptr, when ptr is a void * seems to be a banned construct. I can get around it by using a int/long pointer as well, mapping that to the same address and modifying the contents of the long pointer:</p>
  
  <pre><code>*structOffsetPointer = &amp;(*env)-&gt;GetVersion;
  functionPointer = thisGetVersion;
  structOffsetPointerAsLong = (long *)structOffsetPointer;
  *structOffsetPointerAsLong = (long)functionPointer;
  </code></pre>
  
  <p>but I am concerned that using long or int pointers will cause problems if I switch between 32 and 64 bit environments.</p>
  
  <p>So is there are easy way to disable this error? Assuming not, is either int or long 64 bits under win64?</p>