Problems with fortran library - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problems with fortran library

natrix2natrix2 Posts: 2Member
Hello!!!
I am working with libraries to VBA Excel 2010 (xlsm format), but I have problems in the excel ouputs. This is my script:
* fortran 11
Subroutine FortranDLL( Array1, upbound )
Implicit None
!DEC$ ATTRIBUTES STDCALL, REFERENCE, DLLEXPORT :: FortranDLL
Integer :: upbound
Integer :: Array1(1:upbound)

Integer :: i
do i=1,upbound
Array1(i)=288.16-0.0065*Array1(i)
end do
End Subroutine FortranDLL

* visual basic macro


Option Explicit
Declare Sub fortrandll Lib "fortrandll.dll" (ByRef Array1 As Double, ByRef upbound As Long)

Sub Button1_Click()

Dim II As Long
Dim test(10) As Double

ChDrive (ThisWorkbook.Path)
ChDir (ThisWorkbook.Path)

II = 11
Call fortrandll(test(1), II)
Range("a1").Value = test(1)
Range("a2").Value = test(2)
Range("a3").Value = test(3)
Range("a4").Value = test(4)
Range("a5").Value = test(5)
Range("a6").Value = test(6)
Range("a7").Value = test(7)
Range("a8").Value = test(8)
Range("a9").Value = test(9)
Range("a10").Value = test(10)
End Sub

The problem is that the output is
Sign In or Register to comment.