Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

SQRT, **,... in .dll trouble

mdvandeelen
Beginner
659 Views
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

0 Kudos
3 Replies
Steven_L_Intel1
Employee
659 Views
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.
0 Kudos
mdvandeelen
Beginner
659 Views
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.
0 Kudos
Steven_L_Intel1
Employee
659 Views
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.
0 Kudos
Reply