What can cause "cannot load library mylib.dll (error 126)"?

To add comments, please log in or register
zap
182
zap  
I have developed a custom dll on my home PC (Win Xp Pro). The EA with the imported dll runs perfectly.
When I try to run it on my server (Win Server 2003), it gives error 126. The settings in the platforms are identical, I assume there is something different, something may be missing in OS environment.
What can be missing that cause this error? How can I find the source of the problem?
Slava
Moderator
9628
Slava  
126 is operating system error and documented in the MSDN (Platform SDK - Win32 API - Reference - Error Codes - Win32 Error Codes)
===
126 The specified module could not be found. ERROR_MOD_NOT_FOUND
===
some component may be unavailable
Use "depends.exe your.dll" for investigation
zap
182
zap  
stringo:
126 is operating system error and documented in the MSDN (Platform SDK - Win32 API - Reference - Error Codes - Win32 Error Codes)
===
126 The specified module could not be found. ERROR_MOD_NOT_FOUND
===
some component may be unavailable
Use "depends.exe your.dll" for investigation
Thanks Slawa!
A bunch of DLLs that are needed by importing my dll are missing from the Servers system dir.
I just don't know how is this...
okwh
1630
okwh  
maybe  dll file not in a right directory?
zap
182
zap  
DxdCn:
maybe dll file not in a right directory?
The problem was, that I used shared MFC dlls and my server (well my the setup is a bit cloudy for me, as I rent it) seems that it can only run dlls that use MFC internally (statically linked). All in all, a bunch of MFC dlls were missing from the server's system folder.
I'm not sure what the difference is between the two, but it works.
okwh
1630
okwh  
if statically linked, can run anyhwer, no relation with MFC's Dll.
if linked with shared MFC dlls, will need, MFC's DLL.
you can copy MFC's dll files from your home PC or your develop PC to you server, some things like msvcXXX.dll, MFCXXXX.dll.... in system32 directory.
Try this maybe OK.

if the error message can give which file not load, you can find them.

Use "depends.exe your.dll" for investigation  you can find which dlls used by your dll.
zap
182
zap  
DxdCn:
if statically linked, can run anyhwer, no relation with MFC's Dll.
if linked with shared MFC dlls, will need, MFC's DLL.
you can copy MFC's dll files from your home PC or your develop PC to you server, some things like msvcXXX.dll, MFCXXXX.dll.... in system32 directory.
Try this maybe OK.

if the error message can give which file not load, you can find them.

Use "depends.exe your.dll" for investigation you can find which dlls used by your dll.
I figured out mostly how this MFC really works since my last post, but thanks DxdCn, you confirm what I thougth and hoped. :)
Abhay Agarwal
710
Abhay Agarwal  
Zap:
I figured out mostly how this MFC really works since my last post, but thanks DxdCn, you confirm what I thougth and hoped. :)

Hi Zap,


Can u tell what did u do to solve this problem?


Which MFC dll's did you copy. There are so many. I developed the dll on XP and need to sue on VPS which is Windows 2003 server. Will it matter if I copy the dlls from XP ver to VPS with 2003 OS ?



Abhay

Jinsong Zhang
21143
Jinsong Zhang  
Thank you
Amy Liu
948
Amy Liu  

When you create the dll, use  MFC in static libraries.


To add comments, please log in or register