Click here to Skip to main content
15,042,397 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
In our programming department we have some programs still in VB6. And every now and then an error will popup after compiling a dll. The error just states "Error in loading DLL." No error number or anything.

From then on every time we try to open the dll project that error pops up. We have checked all the references for the project and they are fine. The issue seems to be with VB6 wanting to open the DLL of the project.

So far sometimes restoring from a backup of the project fixes it for a while, sometimes re-registering it fixes it for a while.

I looked at MSDN and found code to use the LoadLibrary API function and ran it on the most recent offending dll and it gave the error code 0, which means "System was out of memory, executable file was corrupt, or relocations were invalid."

I checked the machine and there as no memory issue. As for the other 2 options, I am not sure how to check for those.

Any help would be appreciated.

Thanks,
Chris
Posted

These may help you

Try System File Checker[^]
How To Repair A Corrupt DLL[^]
Unfortunately DLLHelp[^] application was retired on February 8, 2010 and is no longer accessible. :sigh:

FYI
INFO: Diagnosing "Error in loading DLL" with LoadLibrary[^]
Error in loading DLL (Visual Basic)[^]
   
v2
I saw this post in another forum and it seemed to relate. Maybe it will help someone else too.


Quote:
I've seen this error occur when referenced components are recompiled with no compatibility but the previous versions of the dlls are not unregistered beforehand, so the registry keys for the typelibs are not removed and these bogus registry entries point to the new dlls.

Usually I deal with these with an internal registry cleaner tool that can remove typelibs/clsid/interfaces registration based on typelib disk location. You can try moving physical files of the referenced projects to different location on disk and regsvr32 them there, manually remove references from the project file, restart the IDE and reopen project, finally add references and check that dll location in add reference dialog points to the new files location.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900