[ACCEPTED]-dllimport failed to locate dll even though it is in the PATH-dllimport
"DllName.dll could not be found" could 3 also mean that DllImport has not found one 2 of DllName.dll dependencies.
Grab Dependecy Walker to check 1 which dependecy you are missing.
I'd suggest you to use FileMon (sysinternals.com) to 2 check if your assumptions about the library 1 location are right.
DllImport does not consult the PATH environment 8 variable when loading DLL's. I am fairly 7 certain that DllImport follows the standard 6 rules for loading a native DLL in a native 5 program when the DLL is referenced by name. Here 4 is an article which details those rules
http://msdn.microsoft.com/en-us/library/ms682586.aspx
I've 3 found the simplest way to load the DLL is 2 just to put it in the same location as the 1 program I am executing.
I used const string lcms2Path = "C:\\lcms2.dll";
in my C# application for the longest 2 time. But finally moved the DLL to the BIN 1 folder and this works perfect [DllImport("lcms2.dll")]
.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.