I built a 32-bit DLL with Visual Fortran V11.1.067 within Visual Studio 2008 on my computer. The program is supposed to work like this:
EXCEL VBA (32-bit) calls “C:\Test\AA.dll” via the absolute path. Then “AA.dll” calls 3 others (libmmd.dll, msvcr90.dll, svml_dispmd.dll), which are all located in the same path “C:\Test\”. (The 3 dlls are actually Fortran’s inherent dlls, copied from the folder “…\lib\ia32”). It works fine on my computer. But on other computers, VBA always reports the “Run-time error 53: C:\Test\AA.dll not found”.
To solve this problem, I monitored the program using the software “Process Monitor” and found that on other computers, actually AA.dll was found by VBA. But when AA.dll called any of the 3 dlls (libmmd.dll, msvcr90.dll, svml_dispmd.dll), the 3 dlls were scanned (or queried) from the path “C:\Test\”, but the result was unexpectedly “NAME NOT FOUND” shown in Process Monitor. Then VBA continued to search “C:\Windows\” and “C:\Windows\System32\” for the 3 dlls. If they were not there, the result was again “NAME NOT FOUND”. Finally, VBA showed the Run-time error. Based on this finding, I copied the 3 dlls into “C:\Windows\”, then the dlls were found there, and the problem was solved.
But some of my users don’t want me to put the 3 dlls into their system folders, they want me to use the Desktop only. So the “Run-time error 53” comes to me again. So my question is “How can I make my AA.dll recognize the 3 dlls from any path, not limited to the system directories mentioned above?” Thanks very much.