everything compiled:
Code:
  D3DXCompileShader(
    PChar(Memo1.Text),
    length(Memo1.Text),
    nil, nil,
    'main',
    'vs_1_1',
    0,
    @ShaderBuffer,
    @ErrorBuffer,
    @ConstantTable
  );
As Lifepower said it's probably SizeOf(Code)-1 that was causing the problem.