guilhermecgs
guilhermecgs

Reputation: 3061

Types of error messages while trying to load a DLL

In general, when I'm working with DLLs, I can get two different types of error messages when trying to load it:

The specified procedure could not be found

The specified module could not be found

What's the difference between these 2 messages?

Upvotes: 0

Views: 91

Answers (1)

Hans Passant
Hans Passant

Reputation: 942177

"Module not found" is a simple file-not-found problem. You are asking the operating system to locate the DLL and it can't find it. The less intuitive case is where it actually has trouble locating another DLL that is needed, one that the DLL you know about has a dependency on. Trouble-shoot with loader snaps or Dependency Walker in profile mode or SysInternals' Process Monitor.

"Procedure not found" is the next thing that can go wrong. The DLL was located but the OS cannot find the specific function you are trying to call. DLL Hell is the usual source of trouble. The non-intuitive case is where the function actually exists but its name was decorated. C++ name mangling for example. Troubleshoot with Dumpbin.exe /exports to see the exported names.

Not where it ends, the DllMain entrypoint that automatically runs when a DLL gets loaded is a troublemaker. Various error codes try to encapsulate SEH exceptions that are thrown by that function. And loader lock is notorious, it causes deadlock that freezes your program. The kind of mishaps that almost always require a debugger to discover the underlying problem.

Upvotes: 1

Related Questions