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

Error with DLL Use in Excel 2019

Steve__Green
Beginner
1,704 Views

I have used FORTRAN Composer 2013 with VS2010 to build versions of a DLL that I (and many others) have used successfully for about 5 years on machines ranging from Windows 7 with 32-bit Excel to Windows 10 with Excel 2016.  The DLL now does not work with Windows 10, Excel 2019.  Error message is Runtime Error 53, Cannot find file.  I suspect that the DLL is searching for other utilities that are not available in the W10/Excel2019 environment.  In fact, Dependency Walker shows a lot of items referenced by the DLL that it cannot find.  Is there a compiler option that I need to change (I've changed many already) that will resolve this. Or ---- is my FORTRAN or Visual Studio so outdated that I just need to upgrade. 

0 Kudos
6 Replies
Steve_Lionel
Honored Contributor III
1,704 Views

In Dependency Walker, please do a File.. Save As to save a .dwi file. Zip that and attach the zip to a reply here. We'll look at it and give you a recommendation.

I will throw out the suggestion to make sure you are not building a Debug configuration. You can probably also fix this by setting the project property Fortran > Libraries > Use Runtime Library > Multithreaded (/MT).

0 Kudos
Steve__Green
Beginner
1,704 Views

Thanks for the quick response, Doc.  See attached per your request. To  answer your questions

1. This is a Release (not Debug) configuration

2. The Multithreaded /MT option is selected.  I discovered this solution to a similar problem several DLL versions ago (probably based on advice from you to another user in this forum) when one of my users had the same symptom in an earlier version of Excel.

 

0 Kudos
avinashs
New Contributor I
1,704 Views

I have a few suggestions based on my recent experience with the same problem:

1. When my new Office 365 automatically updated, the default version is 64-bit so the old 32-bit DLLs were not compatible. In Excel, check Account -> About Excel to make sure it is the version you want.
2. Build the DLL in Release mode with the options
        /iface:cvf /libs:static /threads /Qm32
3. In 64-bit mode, certain functionality that was previously offered by VBA will not work any more.

0 Kudos
Steve_Lionel
Honored Contributor III
1,704 Views

Thanks for the .DWI. Your DLL is a 64-bit build. Excel typically wants 32-bit DLLs.  I checked my own copy of Office 365 Excel, based on the comment from @avinashs, and it is 32-bit. Try rebuilding as a 32-bit DLL and see if that helps.

0 Kudos
Steve__Green
Beginner
1,704 Views

Steve Lionel,     It's been my experience so far that 64-bit Excel will not communicate with DLLs that were built for 32-bit platforms. Regardless of the Windows OS (7, 8 or 10), if the installed Excel is 32-bit then my DLL has to be built for 32-bit platform. If 64-bit Excel is installed, my DLL has to be built for 64-bit platform.  The wrinkle came when my DLL built for 64-bit platform that worked in 64-bit Excel 2016 would not work for 64-bit Excel 2019.

avinashs,      Making the change from /iface:stdref to one your suggestions of /iface:cvf  did the trick.  The DLL now runs in Excel 2019.  In all my semi-random attempts at trying compiler option changes, I did not try that one.  For the sake of completeness, the command line from the Properties/Fortran/Command Line windows is

/nologo /O2 /iface:cvf /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc100.pdb" /libs:static /threads /c

Dependency Walker still shows unfound files, but I don'care.  I have a DLL that now works in Excel 2019.

Many, many thanks to you.

 

0 Kudos
Steve_Lionel
Honored Contributor III
1,704 Views

It was not clear to me that you had a 64-bit Excel.

I also had assumed that you used the same build options as before. For x64, the main difference between /iface:cvf and /iface:stdref is that the former upcases the Fortran routine name and the latter downcases it. X64 doesn't have STDCALL as a calling convention, but other actions of these options do have effect.

0 Kudos
Reply