title: Access violation -> CreateVertexShader
body: <p>I am playing around with DirectX and I got to the point where I have to play around with shaders among other things. Because D3DX does not exist anymore( :P ) I have to use D3DCompile to compile the shader. I use this piece of code:</p>
  
  <pre><code>D3DCompile(//Vertex Shader
      L"shaders.hlsl",//Pointer to shader data
      sizeof(L"shaders.hlsl"),//Shader size
      NULL,//OPTIONAL, name used in error msgs
      NULL,//OPTIONAL,  An array of NULL-terminated macro definitions(wut?)
      D3D_COMPILE_STANDARD_FILE_INCLUDE,//OPTIONAL, DONT PASS NULL, pass D3D_COMPILE_STANDARD_FILE_INCLUDE which is the defualt
      "VShader",//Name of shaders starting function
      "vs_5_0",//Shader target, vs_5_0 for vertex shader and ps_5_0 for pixel shader
      NULL,//Shader compile options --&gt; http://msdn.microsoft.com/en-us/library/windows/apps/gg615083(v=vs.85).aspx, set to NULL
      0,//Shader effect compile options --&gt; http://msdn.microsoft.com/en-us/library/windows/apps/gg615084(v=vs.85).aspx, set to 0
      &amp;VS,//Pointer to var that will hold shader
      NULL//OPTIONAL, Pointer to var that holds error messages
      );
  </code></pre>
  
  <p>And as you can see I point to <code>VS</code> where the compiled code will be outputted. I then use this code to encapsulate the shaders in a shader object:</p>
  
  <pre><code>m_pDevice-&gt;CreatePixelShader(VS-&gt;GetBufferPointer(), VS-&gt;GetBufferSize(), NULL, &amp;pVS);
  </code></pre>
  
  <p>Where <code>VS</code> is initialized as <code>ID3D10Blob *VS</code> and <code>pVS</code> is initialized as <code>ID3D11VertexShader *pVS</code>  </p>
  
  <p>When I run it(With the rest of the code associated with it) I get a <code>Unhandled expression</code> that is</p>
  
  <pre><code>Unhandled exception at 0x009188FC in Hello_DirectX11.exe: 0xC0000005: Access violation reading location 0x00000000.
  </code></pre>
  
  <p>and when I break out it breaks at the code above when I encapsulated the shader in a shader object.  </p>
  
  <hr>
  
  <p>How do I fix this/what is wrong?  </p>
  
  <p>Also are there any good ways to debug this kind of stuff with VS 2013?</p>