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!
<?xml version="1.0" encoding="UTF-16"?>
<Build>7601 Service Pack 1</Build>
<Product>(0x30): Windows 7 Professional</Product>
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.
Thanks for your reply!
I did use "STDCALL" and here's an example:
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL :: LCCASETSEED
!DEC$ ATTRIBUTES ALIAS:'LCCASETSEED':: LCCASETSEED
!DEC$ ATTRIBUTES VALUE:: ISEED
!use the same function name as in RealCost
integer(kind=4),intent(in) :: ISEED !c.r.t. Long in VB/VBA
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!
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?