Hi all,
I have tried to build a MFC that is statically linked, I have been tracing the problem. I noticed that for my resource DLL it wasn't getting loaded by LoadLIbrary, the error code returned is 126, which is module not found.

But I have also use the call to check if the path exists, and it returns fine. So the problem is not the path, plus, I was able to load the resource DLL when I have VS installed.

This is really to my surprise, since I thought by linking statically I would not need the MFC71.DLL, however, I noticed if I had this file copied to the same directory, but the LoadLibrary does not fail.

My question is of course how to solve this. I have tried changing LoadLibrary() to AfxLoadLibrary() but I was getting compiler error that this call can't be found with look-up, so I added the "_AFXDLL" to the project, well, the compile works, but I see the application calls to MFC.DLL with an error msg pop-up, which brings me back to my very problem.

Questions:
1. How would linking statically be failing with LoadLibrary (error code: 126) which goes away when MFC.DLL is included?

I don't know what to do now. I have read sevearl posts. But most of posts about LoadLibrary failure has to do asking if the file path is correct..etc, and I haven't seen posts about linking statically still requiring MFC.DLL.

Totally clueless. Please let me know if more info is needed..

Thanks for any help,
Jiac