RE: LoadLibrary sometimes fails with error 14.
From: Dan Elliott [MSFT] (dane_at_online.microsoft.com)
Date: 03/12/04
- Next message: Chris Tacke, eMVP: "Re: System.BitConverter on Big-Endian-Platforms"
- Previous message: SteveV: "Re: Automatically reinstalling Compact Framework after hard reset??"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 12 Mar 2004 21:14:04 GMT
This is a known issue in .NET CF v1.0. We believe that it is due to the
fact that CF does not unload P/Invoke'd dlls once they are loaded, but have
not been able to prove this conclusively. This would account for the dll
loading when the app is first launched, but failing to load later.
If this error occurs, it might be possible to unload unneeded modules by
P/Invoking to GetModuleHandle and FreeLibrary, then try the P/Invoke again.
try
{
MyPInvoke();
}
catch (Exception x)
}
string moduleName = "ModuleToUnload.dll";
IntPtr hModule = GetModuleHandle(moduleName);
if (IntPtr.Zero != hModule)
{
FreeLibrary(hModule);
}
}
HTH,
Dan
This posting is provided "AS IS" with no warranties, and confers no rights.
- Next message: Chris Tacke, eMVP: "Re: System.BitConverter on Big-Endian-Platforms"
- Previous message: SteveV: "Re: Automatically reinstalling Compact Framework after hard reset??"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|