c++ - Unmanaged dependency dll fails to load when functions called -
i working in makefiles in cygwin in xp using visual studio 2005 commandline compiler. unmanged code written in c++ , managed code managed c++.
i have project creates bunch of unmanaged dlls , 1 managed dll. managed dll wrapper 1 unmanaged dll has references many other unmanaged dlls.
for example, -> unmanaged / managed --> unmanaged --> unmanaged \ -> unmanaged, etc;
i have managed code test driver loads managed dll, creates object, , makes calls managed wrapper.
so here thing. long leave of needed dlls in same directory test driver executable, works fine. but, need move dlls different directory test driver exe.
if move different directory stop working. (i don't error when run test.exe, "runs" returns command line.) obviously, dll issue.
(just know, can't use gac or %path% test.exe can locate dlls.)
so did lot of searching , have tried variety of methods figure out how test.exe see dlls.
i tried application specified paths. didn't work. , later read http://msdn.microsoft.com/en-us/library/ms682586%28vs.85%29.aspx "the app paths key not used when computing dll search path."
i tried sorts of things manifest files.
i tried bunch of things wouldn't have worked anyway getting desparate.
and have tried app.config approach.
with last approach have had success because test.exe runs dies @ runtime error when test.exe tries execute calls dlls. before gets executed.
for example, if run test.exe asks user information. if information bad returns error user, if information correct returns error:
"error: ascii parsing error occurred: failed load dynamic library [atc15.dll].the specified module not found."
then test.exe continues execute remaining code.
so please me understand how can executable "see" of dlls.
hans made point. have looked @ setdlldirectory (forgot mention it) have never been able work. got same results: execute program , nothing happen.
however, took advice , reinvestigated setdlldirectory function. added:
#include "windows.h" winbaseapi bool winapi setdlldirectorya( __in_opt lpcstr lppathname ); #define setdlldirectory setdlldirectorya
to beginning of code , call to setdlldirectory("c:\path"); , recompiled. ran program , still didn't work.
but added app.config file directory
<configuration> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatepath="putdllshere"/> <dependentassembly> </assemblybinding> </runtime> </configuration>
that worked.
thank hans pointing me in right direction!
Comments
Post a Comment