- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page