Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29267 Discussions

how to send a VBA dynamic array to a fortran dll

mariokaiser
Beginner
754 Views

hello again,

i am still trying to send a vba dynamic array to a fortran dll ad it doesnt really work.

there is no error, but the results computed inside the dll show, that the values of the array didn't get there.

this is my short testprogram:

VBA:

Option Explicit

Private Declare Sub druckabs Lib "fcall.dll" (n As Long, da() As Double, A As Double)

Public da() As Double
Public n As Long
Public A As Double

Public Sub CommandButton1_Click()
n = Worksheets("tabelle1").Range("b3").Value
ReDim da(2)
da(1) = Worksheets("tabelle1").Range("b1").Value
da(2) = Worksheets("tabelle1").Range("b2").Value
Call druckabs(n, da(), A)
Worksheets("tabelle1").Range("b4").Value = A
End Sub

Fortran:

subroutine

druckabs( n, da_SpWB, A_SpWB)

!Einstieg in die Druckabsenkung1-Dll fr Excel: "Pseudo-Hauptprogramm"

!kai 11.11.2006

!DEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS:'druckabs'::druckabs

implicit none

!Deklarationen der Austauschvariablen mit Excel:

!Input:

!a)Geometrie:

integer

, intent(in) :: n

real(8)

, dimension(2), intent(in) :: da_SpWB !Aussendurchmesser SpWB

real(8)

, intent(out) :: A_SpWB !Wandstrke Bden SpWB

A_SpWB = da_SpWB(1) + da_SpWB(2)

end subroutine

druckabs

could anyone please help me??

THX

0 Kudos
1 Reply
mariokaiser
Beginner
754 Views

I got the answer - the prob is solved (reading the help can help Open-mouthed smiley [:-D])

bye

0 Kudos
Reply