I am not sure what you mean? If just talking about the compiling and loading of a shader.
- Creating shaders in VS2013 by adding a new item, Visual C++ -> HLSL then picking the type of shader I want.
- These will compile to .cso files
- Loading the .cso file into memory
- Using ID3D11Device::CreateVertexShader etc. to turn that loaded cso file into one of the shader objects such as ID3D11VertexShader.
- Get/load your shader code
- Use D3DCompile or D3DCompile2 to compile the shader to byte code (the same as the .cso file)
- Use ID3D11Device::CreateVertexShader etc. to create your shader object.
By global variables I guess you means constants (ID3D11Context::VSSetConstantBuffers etc.)? In which case the constants for each type of shader exist separately from whatever the current shader is. If you change shaders and have different constants, you need to set them again.
If you are using the effects system, use D3DX11CreateEffectFromMemory instead of the CreateVertexShader etc. I understand that ID3D11XEffectPass will call all the individual ID3D11Context:: set methods automatically, including putting the effects variables back as the GPU's active constants/variables/globals.