Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Unable to load DLL from Excel VBA

DavidWhite
Valued Contributor II
3,241 Views

I use Excel as an interface to call a Fortran DLL through some VBA code, which references the DLL without explicitly using the installed path. This in on Windows XP Pro with SP2.

After debugging issues like MSJAVA missing on users' machines, I now have one user who gets Error 48, Unable to load DLL.

Dependency walker shows all dependent files to be present, and the path is set correctly.

All other users can run the App successfully, whether logged on as Admin or non-Admin.

Any ideas about what I may have missed in trying to resolve this?

Thanks,

David White

0 Kudos
12 Replies
anthonyrichards
New Contributor III
3,241 Views

Is the DLL in the Windows/system/ directory?

Did you link it using DLL or static libraries?

0 Kudos
DavidWhite
Valued Contributor II
3,241 Views
The DLL is installed in a user folder, not in Windows/System32, as users need to be able to install this App without Admin rights. The installer adds the install location to the users' path. I have successfully tested the install on three different machines, including my development machine, and two others, using both Admin and non-Admin logons. On a fourth user's machine, however, Excel fails to load the DLL.

On this user's machine, I have opened the dLL using Dependency Walker, and except for MPR.DLL (happens on all machines), all dependencies are satisfied, including libifcore.dll, etc, which are installed as part of the package.

Again, on this user's machine, from the command prompt, I was able to locate the DLL, so the PATH is set correctly.

Asking about the libraries may be the key -- one of the libraries is set to use Multithreaded DLL, while all the others are Multithreaded Static.

I'll let you know how this goes - will take until Thursday to catch up with this user.

Regards,

David
0 Kudos
DavidWhite
Valued Contributor II
3,241 Views
In deeper water now!

I can't build with Static libs -- results in multiple errors, unresolved external reference __fltused not found, etc. Can't see easily which library is involved. Any tips would be helpful.

David
0 Kudos
Steven_L_Intel1
Employee
3,240 Views
Turning on the linker "Verbose" option can show you which libraries are being searched and where symbols are being resolved. You need to make sure that all components of your project are built with the same library setting.
0 Kudos
DavidWhite
Valued Contributor II
3,240 Views
Steve,

Found out from one of Jugoslav's posts that __fltused is in libcmt.lib, which was excluded in my build.

Will advise whether the original problem with Excel is now solved.

Thanks,

David
0 Kudos
DavidWhite
Valued Contributor II
3,240 Views

Steve,

My user is still reporting error 48 from the Excel interface -- which is unable to load DLL.

I have just run depends on my version -- I am now getting a dependency problem with MSJAVA.DLL msiing in MSHTML.DLL, which is a known issue in XP SP2. Don't know if this is causing the problem with Excel.

Any ideas anyone?

David

0 Kudos
Steven_L_Intel1
Employee
3,240 Views
What I would do is write a simple Fortran program that contains a call to one of the DLL routines and link it with the DLL's export library. Place the EXE and the DLL in the same directory on the user system and run the program. If there's a DLL loading error, you'll get a very descriptive message telling you what is missing. The Fortran program doesn't have to actually do anything or even make the call - as long as the reference is there. For example:

program testit
read (*,*)
call dllsub
end

where you ^C at the read.
0 Kudos
DavidWhite
Valued Contributor II
3,240 Views
Steve,

The App is already running on a number of machines and by a number of users, it is simply one user that has this problem, so your solution would not help, esp. as this user does not have a debugger on their machine.

However, I have progressed since yesterday, and I think I now have proof that the error is in the users' PATH setting. I have previously tried typing the DLL name from the cmd prompt line, and got an error which seemed to indicate that the DLL was found - this, I thought told me that the PATH was correct.

The user, however, has now copied all the DLL's (including libif*, etc) from the App install folder to their system32 folder, and the App now works. I think this says that even though dependency walker finds all of the library DLL's, for some reason, when Excel loads the DLL, it does not find them all. My hunch is that there may be a non-existent folder in the PATH variable, and Excel spits the dummy.

Thanks,

David
0 Kudos
Steven_L_Intel1
Employee
3,240 Views
My suggestion does not require the debugger and would tell you exactly which DLL can't be found.
0 Kudos
DavidWhite
Valued Contributor II
3,241 Views

Steve,

Will follow up your suggestion, but not sure now whether we can reproduce the error. One thought, however, if the user had an old copy of an intel library installed in their system32 folder, and the newer one in the App folder, could this have caused this kind of error?

David

0 Kudos
Steven_L_Intel1
Employee
3,241 Views
Unless the DLL was in the folder of the EXE, it would be ignored. It would be useful to see what the real error is, which my test would reveal.
0 Kudos
DavidWhite
Valued Contributor II
3,241 Views

Steve,

User has confirmed that when they copied the libifcoremd, libifportmd and libmmd files to system32, they replaced some files which were approx 50% of the size of the new files.

User has now removed these files from system32 and App continues to work, which seems to confirm that incompatible libraries were the cause of this problem.

I have created a test program, as you suggested, but can't now test it, although I will have it should a similar problem arise with another user.

Thanks for the help.

David

0 Kudos
Reply