I have some questions about the order of initialization for the CLR and the CRT for mixed .NET assemblies (i.e. meaning mixed managed/unmanaged C++ assemblies).
So if I have a mixed mode assembly dll file, and it gets loaded via Assembly.Load. I notice that any static native objects won't get initialized or called until some managed code is called first. OK. So I take it that on startup that the CLR code gets initialized first, and CRT initialization gets called last. How is the order for shutdown? Is the CRT shutdown first, and the CLR shutdown last?
So is this how it goes?
start of program lifetime
initilialize CLR
...initilialize CRT
...construct native static instances
... program runs....
...shutdown CLR
...destruct native static instances
shutdown CLR
end of program lifetime
Or is it in some other order?
My question also applies to mixed mode assemblies that are executables (i.e. .exe). It is similar?
start of program lifetime
initilialize CLR
...initilialize CRT
...construct native static instances
... program runs....
...shutdown CLR
...destruct native static instances
shutdown CLR
end of program lifetime