LoadLibrary failes 
Author Message
 LoadLibrary failes

Hello!
I am having this problem: In a dll, I am trying to load another dll by using
LoadLibrary(path). That function fails with error code 126 which means can't
find specified module. I have verified that the dll I am trying to load does
exist in the correct location and could be regisetered from there i.e. it
can be loaded. Does anyone has any idea why would LoadLibrary fail?
Thank you.


Mon, 10 Oct 2005 00:55:16 GMT  
 LoadLibrary failes
Do you use an absolute or relative path? Be aware that the new DLL will
be searched relative to the EXE, not the DLL, so if you, say, rely on
the DLL to be loaded being in the same folder as the DLL that does the
loading, but the EXE is in a different folder, the DLL won't be found.
Use full path instead.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken



Quote:
> I am having this problem: In a dll, I am trying to load another dll by
using
> LoadLibrary(path). That function fails with error code 126 which means
can't
> find specified module. I have verified that the dll I am trying to
load does
> exist in the correct location and could be regisetered from there i.e.
it
> can be loaded. Does anyone has any idea why would LoadLibrary fail?



Mon, 10 Oct 2005 00:58:28 GMT  
 LoadLibrary failes
I am using an absolute path, but the host dll is used by terminal services
when a virtual channel opened connecting to an executable on the server.


Quote:
> Do you use an absolute or relative path? Be aware that the new DLL will
> be searched relative to the EXE, not the DLL, so if you, say, rely on
> the DLL to be loaded being in the same folder as the DLL that does the
> loading, but the EXE is in a different folder, the DLL won't be found.
> Use full path instead.
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > I am having this problem: In a dll, I am trying to load another dll by
> using
> > LoadLibrary(path). That function fails with error code 126 which means
> can't
> > find specified module. I have verified that the dll I am trying to
> load does
> > exist in the correct location and could be regisetered from there i.e.
> it
> > can be loaded. Does anyone has any idea why would LoadLibrary fail?



Mon, 10 Oct 2005 01:14:19 GMT  
 LoadLibrary failes

Quote:
> I am using an absolute path, but the host dll is used by terminal services
> when a virtual channel opened connecting to an executable on the server.

What path, precisely, put it in "" 's and we'll see if you do same as you
mean. ;-)


Mon, 10 Oct 2005 02:56:52 GMT  
 LoadLibrary failes
Path is something like that: "c:\directory1\somename.dll". There are no
spaces.


Quote:
> > I am using an absolute path, but the host dll is used by terminal
services
> > when a virtual channel opened connecting to an executable on the server.

> What path, precisely, put it in "" 's and we'll see if you do same as you
> mean. ;-)



Mon, 10 Oct 2005 04:34:44 GMT  
 LoadLibrary failes


Quote:
> Path is something like that: "c:\directory1\somename.dll". There are no
> spaces.

Try: "c:\\directory1\\somename.dll"

--
Jeff Partch [VC++ MVP]



Mon, 10 Oct 2005 04:40:05 GMT  
 LoadLibrary failes
I get this string out of the registry as a char *  so it has the correct
number of slashes.


Quote:


> > Path is something like that: "c:\directory1\somename.dll". There are no
> > spaces.

> Try: "c:\\directory1\\somename.dll"

> --
> Jeff Partch [VC++ MVP]



Mon, 10 Oct 2005 04:54:44 GMT  
 LoadLibrary failes


Quote:
> I get this string out of the registry as a char *  so it has the correct
> number of slashes.

Okay, sorry. :(

--
Jeff...



Mon, 10 Oct 2005 04:56:13 GMT  
 LoadLibrary failes

Quote:
> Hello!
> I am having this problem: In a dll, I am trying to load another dll
> by using LoadLibrary(path). That function fails with error code 126
> which means can't find specified module. I have verified that the dll
> I am trying to load does exist in the correct location and could be
> regisetered from there i.e. it can be loaded. Does anyone has any
> idea why would LoadLibrary fail?

Perhaps the DLL in question has other dependencies that it cannot find?

Have you tried using the DependencyWalker tool?

--
Reginald Blue



Mon, 10 Oct 2005 23:33:28 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. LoadLibrary failes with 31 ERROR_GEN_FAILURE under Windows 98

2. LoadLibrary failes with 31 (ERROR_GEN_FAILURE)

3. LoadLibrary generates MessageBox when failing to loadlibrary in Managed C++

4. LoadLibrary() from within module loaded by LoadLibrary() ?

5. CoCreateInstanceEX failes in a DCOM architecture

6. DOMDocument create failes in service

7. GetDlgControl on ITreeView failes on Win2000...Please help !!!

8. CDatabase.Open failes

9. SetColumnWidth() failes for a CListCtrl

10. HELP - assert in CListCtrl failes

11. MFC App failes during load

12. intermitant START PAGE failes on CDC.

 

 
Powered by phpBB® Forum Software