Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Avisos
Important Update: Community Platform Migration​. Learn more​>
29649 Discusiones

Give returnarray from *.dll value when *.dll is called

mini_minsaas
Principiante
1.834 Vistas
Hello! When I try to give an array inside a DLL using the command outputArray(:) = 0, I got an error. I'm using this DLL together with C#.

Any suggestion?

My DLL looks like this:

SUBROUTINE CalcUniI(inputData, outputData)
! Expose subroutine CalcUniI to users of this DLL
!
!DEC$ ATTRIBUTES DLLEXPORT::CalcUniI

USE I

IMPLICIT NONE

REAL, INTENT(IN) :: inputData(*) ! inputData(t1, t2, t3, b1, b2, h, c1, c2)
REAL, INTENT(OUT) :: outputData(*) ! outputData(NAy, NAz, A, Iy, Iz, Wy, Wz, Ry, Rz, Sy, Sz, K)

outputData(:) = 0.0

CALL Calculate(inputData, outputData)

END SUBROUTINE CalcUniI
0 kudos
1 Responder
Steven_L_Intel1
Empleados
1.834 Vistas
Because OutputData is declared as an assumed-size array (dimension(*)), the compiler has no idea how big it is and thus you can't do any array operations, such as assignment, that require knowledge of the size.

One alternative is to pass the size as a separate argument and then use that argument as the bound, for example, OutputData(N). Remember also that in Fortran, arrays start at element 1 whereas in C# (and many other languages), they start at zero.

You might also need to pass in the size of the InputArray depending on your code's needs.
Responder