What might prevent a DLL from loading with LoadLibrary?

Mark Ransom picture Mark Ransom · May 9, 2009 · Viewed 10.3k times · Source

I have a JD Edwards business function, which is written in Microsoft Visual C++ as a C module. I'm using LoadLibrary to access a third party DLL. In a standalone test program, the code runs just fine. When I run it from within JDE, LoadLibrary returns NULL and GetLastError returns 126, which means The specified module could not be found according to MSDN. I've tried putting in the full path to the DLL, and yes I've remembered to double up the \ characters in the path. No difference.

I've checked to make sure there are no dependencies that would keep the DLL from loading; DUMPBIN /DEPENDENTS returns the following:

WSOCK32.dll
USER32.dll
GDI32.dll
WINSPOOL.DRV
ADVAPI32.dll
KERNEL32.dll

These look like standard Windows DLLs, so I'm at a loss.

Answer

Dirk Vollmar picture Dirk Vollmar · May 9, 2009

A missing dependency? Have you checked with Dependency Walker that all referenced libraries are found?