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

 
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?
 
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
 
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...
 
maybe  dll file not in a right directory?
 
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.
 
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.
 
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. :)
 
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

 
Thank you
 

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


 

You can update mfc, i solove this error for update mfc. 

https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170

Latest supported Visual C++ Redistributable downloads
Latest supported Visual C++ Redistributable downloads
  • 2021.10.07
  • corob-msft
  • docs.microsoft.com
This article lists the download links for the latest versions of Visual C++ Redistributable packages.