- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Update: I am seeing evidence that this is more of a build error at this time. I am going to close this myself as
answered and re-open if it is not a build error.
I have no trouble passing a simple integer or float by reference or by value to a Fortran subroutine but I
can not do the same with an Array. I get an error that indicates that the subroutine cant be found but it
can be found if i change the arguement to not be an array. Any ideas. Here is some info.
C# sidedeclare Fortran dll:
[DllImport("fortrandll.dll",
CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern void f_array(ref float[] arr1x100);
// declare array
float[] arr1x100 = new float[100];
// Call the the fortran routine vy reference
f_array(ref arr1x100);
!! FORTRAN SIDE:
subroutine f_array( Arr1x100)
IMPLICIT NONE
!DEC$ ATTRIBUTES DLLEXPORT :: f_array
!DEC$ ATTRIBUTES REFERENCE :: Arr1x100
integer, parameter :: maxsize=100
integer :: i
real(4), dimension (maxsize), intent(inout) :: Arr1x100
DO i=1, maxsize
Arr1x100(1:i)=i
END DO
end subroutine
RESULTING ERROR
Unable to find an entry point named 'f_array' in DLL 'fortrandll.dll'.
answered and re-open if it is not a build error.
I have no trouble passing a simple integer or float by reference or by value to a Fortran subroutine but I
can not do the same with an Array. I get an error that indicates that the subroutine cant be found but it
can be found if i change the arguement to not be an array. Any ideas. Here is some info.
C# sidedeclare Fortran dll:
[DllImport("fortrandll.dll",
CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern void f_array(ref float[] arr1x100);
// declare array
float[] arr1x100 = new float[100];
// Call the the fortran routine vy reference
f_array(ref arr1x100);
!! FORTRAN SIDE:
subroutine f_array( Arr1x100)
IMPLICIT NONE
!DEC$ ATTRIBUTES DLLEXPORT :: f_array
!DEC$ ATTRIBUTES REFERENCE :: Arr1x100
integer, parameter :: maxsize=100
integer :: i
real(4), dimension (maxsize), intent(inout) :: Arr1x100
DO i=1, maxsize
Arr1x100(1:i)=i
END DO
end subroutine
RESULTING ERROR
Unable to find an entry point named 'f_array' in DLL 'fortrandll.dll'.
Link Copied
0 Replies
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