- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Possibly someone out there has experienced something similar?
Finally got beyond the "bad entry point" issue signified by error 453.
Excel is "talking" to the fortran DLL.
Issue is now the following:
1 - when the fortran is compiled without debugging, the DLL is able to be executed one time and it will work fine. The second attempt to use the DLL returns 65535 values and obviously does NOT run correctly.
2 - when the fortran is compiled with debug and there is an effort to debug the DLL through connection through the spreadsheet, at the end of the run and just before leaving the fortran subroutine, the following error is thrown....."cannot find the VBE7.PDB".
3 - finally, when the code is compiled with debug and NOT stepped through and, instead, just executed, it throws an error 11, division by zero.
Incidentally, there are no "hits nor runs nor errors" evident with the same EXACT code when compiled through the console.
Runs every time.
Any help appreciated.
Thanks.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Reads very much to me as a calling convention mismatch. Did you specify ATTRIBUTES STDCALL, REFERENCE on your Fortran procedure?
There is a complete worked Excel example in the Parallel Studio XE for WIndows sample bundle.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, the following is at the start of the subroutine.
SUBROUTINE NGCDT ( OUTPUT )
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS: "NGCDT" :: NGCDT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How is OUTPUT declared, and what is your declaration of the routine in Excel?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In excel:
Public Declare PtrSafe Sub NGCDT Lib "C:\WINDOWS\System\MyDLL.dll" (ByRef MyIOArray As Double)
'Function that returns windows temp directory
Declare Function WinTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Other statement in fortran is the following:
!DEC$ ATTRIBUTES REFERENCE :: OUTPUT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If, as suggested by the name, MyIOArray is an array, then the function call needs to pass the first element MyIOArray(0) or MyIOArray(1), depending on whether you are using Option Base 1 in Excel.
In addition, you need to pass the number of elements in the array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
with Option Base 1
Call NGCDT(dIOData(1, 1))
did i understand you correctly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Guaglardi, Paul wrote:
In excel:
Public Declare PtrSafe Sub NGCDT Lib "C:\WINDOWS\System\MyDLL.dll" (ByRef MyIOArray As Double)
'Function that returns windows temp directory
Declare Function WinTempPath Lib "kernel32" Alias "GetTempPathA" (ByVal nBufferLength As Long, ByVal lpBuffer As String) As LongOther statement in fortran is the following:
!DEC$ ATTRIBUTES REFERENCE :: OUTPUT
What this not solved in this thread? It seems the exact same procedures are involved, especially considering Quote #7 by OP:
https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/758963
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dear Steve or Dear Dr. Fortran: I have been experiencing a similar problem, can please advise? My excel (32-bit) "can not fine the Dll file" when run the VBA code. However, once a while after I re-compile (or rebuilding) the Fortran program, I can debug inside the FORTRAN coding to link to excel to read inputs, and then outputs to excel. I tried both x86 and x64 compiling in Fortran (two available options for me) and got the same error information. My computer is a x64 system. I don't know what is the cause and how to debug it as everything else looks correct. Thank you very much! Best, and happy holiday season.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That error from VBA usually means that a DLL that your DLL depends on cannot be found by searching the PATH environment variable. This is usually because you built a debug configuration and are running Excel from outside Visual Studio. Try building a Release configuration. An alternative is to set the project property Fortran > Libraries > Use Runtime Library to "Multithreaded (/MT):".

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page