I have read a few threads on this forum about this very problem and I think I have implemented all the suggestions but still cannot solve my problem.
Here is the problem: I used to have a DLL built in Intel fortran compiler 10 and I used to call it from Excel 2003 in my old WinXP laptop. That worked perfectly fine. My company gave me a new laptop with Window7 and Excel 2010 32bit on it and suddenly nothing works.
The first thing I noticed was that the Intel Fortran Compiler 10 was advertised by Win7 as not compatible and I thought that was the problem. I asked and obtained a new Intel(R) Visual Fortran Compiler XE 220.127.116.11 and immediately tried again to compile my dll. No success.
I created a minimum working case that still reproduces the problem and submitted to intel to ask for their help. They answered with a fix and I implemented the fix. Still nothing.
I removed the Excel 2010 32bit and substituted with Excel 2010 64bit, no improvement.
Since at this point I am lost I am posting my case hoping that someone will spot a problem:
! test_Dll1.f90 ! ! FUNCTIONS/SUBROUTINES exported from test_Dll1.dll: ! test_Dll1 - subroutine ! function test_Dll1(x,y,z) implicit none double precision :: x,y,z,test_Dll1 ! Expose subroutine test_Dll1 to users of this DLL ! !DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS:"TEST_Dll1_F" :: test_Dll1 ! Variables ! Body of test_Dll1 test_Dll1=x+y+z end function test_Dll1
Visual basic for application code:
Private Declare PtrSafe Function TEST_DLL1_F Lib "C:\tmp\test_Dll1.dll" (ByRef x As Double, ByRef y As Double, ByRef z As Double) As Double Function Test_Dll1(Arg1 As Double, Arg2 As Double, Arg3 As Double) As Double Test_Dll1 = TEST_DLL1_F(Arg1, Arg2, Arg3) End Function
I manually copy the dll in the position specified to keep the path short. I tried to put it together with the excel file, in system32 and in a few other places with no success.
The funny thing is that excel writes #value! but doesn't raise any issue. If I try to debug from Fortran it never enters the dll and hence is never captured by the debugger.
The lack of error message on excel side puzzles me since I have no clue what it is wrong and what to fix.
I have also attached this MWE as a zip file.