Even a chimp can write code

Monday, November 07, 2005

DLL search order during loading

On Windows, LoadLibrary has most affinity for the directory from where application was loaded. Thus, if you have foo.dll in the %windir%/system32 folder and another copy in the same directory as your application, when foo.dll is referenced from that application, the version co-located with the application is always loaded.

This MSDN article talks in more detail about DLL search order.

For managed code dependencies, the Global Assembly Cache always prevails; the local assembly in application directory will not be picked up if there is an existing (or newer with policy) copy in the GAC.


Email this | Bookmark this