- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have recreated theCVF example.dll files and they compile and run without issue. When I attempt to raise a number to a power, the dll compiles without error but an error is generated when I run it from excel. I am wondering if I am not linking to a needed math library.
A modified Fcall.dll example is below.
Code:
! Example of Excel calling Intel Visual Fortran ! Excel code passes an integer and a character string to FortranCall ! The integer is doubled, converted to a string and returned in the second argument ! Excel calls always use the STDCALL mechanism ! subroutine FortranCall (r1, num) !DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS:"FortranCall" :: FortranCall integer, intent(in) :: r1 character(10), intent(out) :: num real(4) :: test, A, B !DEC$ ATTRIBUTES REFERENCE :: num !This dll runs correctly if the example lines 1-3 are commented out. If example lines 1-3 are !compiled, the dll crashes when accessed by excel. !A=0.12345 !example line(1) !B=3.1334 ! example line(2) !test = B**A !example line(3) num = '' write (num,'(i0)') r1 * 2 return end subroutine FortranCall
Thank you for your time.
Mike Van Deelen
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is this on the same system where the DLL was built? You will need to have available, and present in one of the folders named by the PATH environment variable, any DLL referenced by your DLL. Dependency Walker is a good tool for debugging this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Same system. I have already been through debugging with Dwalker. The onlywarning i get is
"Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module."
which I should be able to ignore in this case.
I have made many dlls and the only time there is trouble is when I do operations using intrensic functions, SQRT, **, SIN() etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The next step I would recommend is to run this in the debugger. In your DLL project properties, Debug tab, set the path of the executable to be that of Excel. Set a breakpoint in your function and start execution. Step through the statements and see what happens.

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