No, AppDomains is a concept with clean, managed code. It achieves isolation, preserving the individual roots of the managed entity. One AppDomain cannot see the objects of another, making it very safe to cancel code and unload assemblies. In no case do not delete all data that may contain state.
Unmanaged code is completely agnostic of the GC heap and, therefore, AppDomains, it will allocate its own native heap (HeapAlloc) in its data section. Such distributions are global processes. This makes the isolation boundaries process, you need an auxiliary process that loads the DLL and talks to it with one of the mechanisms of the .NET process interaction (socket, named pipe, memory mapped file, remote access, WCF).
Technically, you can create copies of DLLs, each of which has a different name. But this is very small, and pinvoke is very inconvenient, since you can no longer use [DllImport]. To initialize delegate objects, you need to declare a delegate for each exported function and LoadLibrary () and GetProcAddress ().
Hans passant
source share