static ManagedToNativeWrapper()
{
EventHandler onShutdown;
AppDomain currentDomain;
IStreamVtbl newVtable;
onShutdown = new EventHandler(OnShutdown);
currentDomain = AppDomain.CurrentDomain;
currentDomain.DomainUnload += onShutdown;
currentDomain.ProcessExit += onShutdown;
newVtable = new IStreamVtbl();
newVtable.QueryInterface = new QueryInterfaceDelegate(QueryInterface);
newVtable.AddRef = new AddRefDelegate(AddRef);
newVtable.Release = new ReleaseDelegate(Release);
newVtable.Read = new ReadDelegate(Read);
newVtable.Write = new WriteDelegate(Write);
newVtable.Seek = new SeekDelegate(Seek);
newVtable.SetSize = new SetSizeDelegate(SetSize);
newVtable.CopyTo = new CopyToDelegate(CopyTo);
newVtable.Commit = new CommitDelegate(Commit);
newVtable.Revert = new RevertDelegate(Revert);
newVtable.LockRegion = new LockRegionDelegate(LockRegion);
newVtable.UnlockRegion = new UnlockRegionDelegate(UnlockRegion);
newVtable.Stat = new StatDelegate(Stat);
newVtable.Clone = new CloneDelegate(Clone);
managedVtable = newVtable;
CreateVtable();
}