Software Archive
Read-only legacy content
17061 Discussions

VBA calling a FORTRAN DLL problem on some platforms?

Intel_C_Intel
Employee
253 Views
Hello,

I'm having a problem calling a Visual FORTRAN subroutine located
in a .dll from an Excel VBA macro. I followed the fantastic article
by Lorri Menard, Calling Visual Fortran from Visual Basic from the
Newsletter Issue I, February 1998.

While this works file when I'm running Excel 97 on Windows 98
(where the dll was built), I have problems using this application on
other platforms. Specifically, Excel 97 on Windows 95 and Excel
for Office 2000 on Windows 2000. Excel returns an error saying
my dll file is not found.

I'm using Compaq Digital FORTRAN Professional Edition 6.1.0 to
create a dll that contains one small subroutine with no parameters.
I use the following export line:

!DEC$ ATTRIBUTES DLLEXPORT::DLLTEST

I build my dll no problem and place it in a specific directory,
c:mydirdlltest.dll

In my Excel macro I have the following DECLARE statement:

Public Declare Sub DLLTEST Lib "c:mydirdlltest.dll" ()

and the following CALL statement in my macro:

Call DLLTEST

It runs fine in this configuration on Win98/Excel 97.
When I run my macro on the problem systems, I receive an
error from Excel: run time error 53 file not found c:mydirdlltest.dll.
I have also received run time error 48 file not found. The dll file is
definately in the directory, but Excel can not find it or doesn't like it.

I have tried placing my dll file in a directory in my path, and removing
the fully qualified portion of the filename in the DECLARE statement.
I get the the same error.

I looked around in the Microsoft knowledge base. There are articles
that indicate this type of error could have been caused by 32-bit Excel
calling a 16-bit dll or if I was using the _cdecl calling convention in
Excel 97. As far as I can tell, my dll is 32 bit and Win95/Win2000 are
32 bit, and I'm using the standard calling convention as opposed to
_cdecl.

I built the dll in visual fortran installed on Windows98, will I have to
build dlls on Win95 or Win2000 to get my application to work there?

Anyone run into this type of problem? Or have any ideas on a solution?

Thanks for any information,

Blair Hanna

blair.hanna@colorado.edu
0 Kudos
2 Replies
Steven_L_Intel1
Employee
253 Views
The problem is more likely that the Visual Fortran run-time DLLs aren't installed on the other systems. Your Fortran DLL is implicitly linked against the VF run-time DLLs, which must be present. The easiest way to get them there is to download and run VFRUN65I.exe - you also may be able to get away with just copying DFORRT.DLL from your system where CVF is installed to the Windows System folder of the other systems.

Steve
0 Kudos
Intel_C_Intel
Employee
253 Views
Steve-

Thank you very much for the info! Yes of course that was the problem and
installing DFORRTL.DLL is all I needed for my application to work fine.

Thanks again for the support!

Blair
0 Kudos
Reply