Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.