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

IVF Fortran DLL with Crashes Excel Macro Files

George_C_1
Beginner
428 Views

I've built a IVF Fortran DLL with IMSL functions and make the function calls available to an Excel Macro app.
The DLL is built by using the static linking. However, the libiomp5md.dll is still required to run this application.
Then, I encounter the crashing of Excel whenever I "exit" or "close" the Excel app after running at least once the IMSL function calls from the Excel files.
The MS Windows instructed me to look at three files: WERF8D1.tmp.WERInternalMetadata.xml, WERFDB2.tmp.appcompat.txt, and WERFF0B.tmp.hdmp. See attached.

Please advise how to resolve the above Excel crashing issues!

TIA!
George
~~~ WERF8D1.tmp.WERInternalMetadata.xml~~~~~~~~~~
<?xml version="1.0" encoding="UTF-16"?>
<WERReportMetadata>
<OSVersionInformation>
<WindowsNTVersion>6.1</WindowsNTVersion>
<Build>7601 Service Pack 1</Build>
<Product>(0x30): Windows 7 Professional</Product>
<Edition>Professional</Edition>
<BuildString>7601.24291.amd64fre.win7sp1_ldr_escro w.181110-1429</BuildString>
<Revision>1130</Revision>
<Flavor>Multiprocessor Free</Flavor>
<Architecture>X64</Architecture>
<LCID>1033</LCID>
</OSVersionInformation>
<ProblemSignatures>
<EventType>APPCRASH</EventType>
<Parameter0>EXCEL.EXE</Parameter0>
<Parameter1>16.0.9126.2315</Parameter1>
<Parameter2>5bdb914a</Parameter2>
<Parameter3>libiomp5md.dll</Parameter3>
<Parameter4>5.0.2018.209</Parameter4>
<Parameter5>5a7d85c2</Parameter5>
<Parameter6>c0000005</Parameter6>
<Parameter7>000b3273</Parameter7>
</ProblemSignatures>
<DynamicSignatures>
<Parameter1>6.1.7601.2.1.0.256.48</Parameter1>
<Parameter2>1033</Parameter2>
</DynamicSignatures>
<SystemInformation>
<MID>31C4A134-1306-44F1-BDCD-26B21A3CA91F</MID>
<MarkerFile>1028_Dell_LAT_E7470</MarkerFile>
<SystemManufacturer>Dell Inc.</SystemManufacturer>
<SystemProductName>Latitude E7470</SystemProductName>
<BIOSVersion>1.6.3</BIOSVersion>
</SystemInformation>
</WERReportMetadata>

0 Kudos
4 Replies
George_C_1
Beginner
429 Views

Strangely, the Excel crashing disappears after the VBA code calls the IVF DLL function! Sounds good but still worrysome! 

0 Kudos
Steve_Lionel
Honored Contributor III
429 Views

Usually my first guess in situations such as this is that the Fortran routines called from Excel are not given the STDCALL attribute. Since Excel (and VBA) expect STDCALL, this corrupts the stack. Whether or not this will result in a crash, or where it gets reported, all depends on what else the program does.

I note with some interest that in the call history there is libiomp5md.dll, which is the OpenMP library. IMSL uses this to multithread some of its routines. If the OpenMP stack is too small, it could cause a crash, but there are many other possibilities. I think the data you posted indicates an access violation, which bolsters my guess about a calling convention mismatch.

If this isn't enough of a clue for you, please post the Fortran procedure header, declarations of any dummy arguments and any directives you have inserted, for the routine being called when the error appears. Also show us the Fortran command line used to compile the source.

Last, I would have suggested that you read the IMSL End User License Agreement, but Intel has removed it from its web site in the (mistaken in my view) notion that just because they aren't selling it that means all information usable by current users should be eliminated. My recollection is that one of the terms in the IMSL EULA is that you aren't permitted to use Fortran merely to pass through IMSL to another application.

0 Kudos
George_C_1
Beginner
428 Views

Hi Steve,

Thanks for your reply!

I did use "STDCALL"  and here's an example:

~~~~~~~~~~~~~~~~~~~~

SUBROUTINE LCCASETSEED(ISEED)
   !DEC$ ATTRIBUTES DLLEXPORT, STDCALL :: LCCASETSEED
   !DEC$ ATTRIBUTES ALIAS:'LCCASETSEED':: LCCASETSEED
   !DEC$ ATTRIBUTES VALUE:: ISEED
     !use the same function name as in RealCost
   use RNSET_INT
   integer(kind=4),intent(in) :: ISEED !c.r.t. Long in VB/VBA
   !---------------------------------------------------------------------------
   CALL RNSET(ISEED)
END SUBROUTINE LCCASETSEED

~~~~~~~~~~~~~~~~~~~~

There are no errors occurs during the function calls. It is just that Excel crashes after it is closed - which is now not happening anymore. 

Though I use static link to IMSL, I still have to have libiomp5md.dll for the Fortran DLL to refer to - as you pointed in another thread.

I will look for the IMSL EULA to read through. Thanks!

Cheers

George

 

0 Kudos
Steve_Lionel
Honored Contributor III
429 Views

Are you sure you need VALUE there? (It's redundant here because of STDCALL). Normally things are passed from VBA/Excel by reference, in which case you'd need REFERENCE instead of VALUE.

Does the error happen after calling just this routine?

0 Kudos
Reply