1
我加載使用此方法的COM DLL:處理對象時應該釋放一個加載的模塊嗎?
[DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)]
private extern static IntPtr LoadLibrary(string librayName);
我應該釋放使用DLL:
[DllImport("kernel32", SetLastError = true)]
private static extern bool FreeLibrary(IntPtr hModule);
或只是讓應用程序終止處理呢?
+1爲了進一步澄清,只*釋放使用LoadLibrary加載的DLL。您不應該釋放像「system32」,「kernel32」等任何系統DLL,*或任何您使用`GetModuleHandle`獲得的句柄的DLL。有關詳細信息,請參閱[文檔](http://msdn.microsoft.com/zh-cn/library/ms683152.aspx)。 – 2011-01-30 12:07:17