5
votes

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.

6

6 Answers

5
votes

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

3
votes

If you attach a debugger during the LoadLibrary call, it may spew error info to debug output. In addition to the other suggestions here, if the manifest has an error in it this issue will occur.

I'm pretty sure its a dependency issue for you though. Try the ProcMon thing, and also try running on Vista to see if that solves the problem. You can get a test VPC image here.

2
votes

I went once into the same nightmare. It was impossible to diagnose anything, I just found out that reseting the dll search list order path (the keyword here is probably 'list', not 'order') fixed the issue.

SetDllDirectory(NULL);

The explanation is that a third-party DLL in the middle was probably messing with it, without restoring its original state. This could explain why only your test application was working.

0
votes

You might try testing while ProcMon is running and see if any errors are visible in it while file monitoring is enabled.

0
votes

In addituion the Dependency walker can be run using the profile option. In this case the exe has to be loaded in dependency walker. Afetrwards the menu "Profile" can be used.

The application is started then and the dll tree is filled. This will also show if a delay loading dll is missing and other stuff.

0
votes

If you don't find an answer by checking dependencies, I would suggest concentrating on possible issues due to the architecture.

You mentioned that you're using a standalone test environment, but when you try it in a regular environment it doesn't work. Is the Business Function setup to run in the server?

It's been quite a while since I last worked with JDE. I remember that one time I wrote a BSFN in C to call several UBEs in a sort of synchonization and it worked fine on my local machine and didn't work when I was testing on the server. There was something about the server not being able to find the DLL (even though I was providing a path) and some settings that were required. Also, there was a difference that was critical in my case: on my machine, the BSFN would wait for the completion of the UBEs and would capture the status, on the server it wouldn't and it also had to do with settings on objects.

Again, if you don't find anything usefull, try asking for help on www.jdelist.com.