- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code below is the main program (compiled withanother fortran compiler)calling a function in a dll which is compiled with Intel Fortran Compiler.
Code:
PROGRAM prgSample interface function DllFunc(Array) Real(4),intent(in) :: Array(:) Real(4) :: DllFunc end function end interface Real(4)::Array(10),DllReturn Array=0 DllReturn=DllFunc(Array) PRINT*,'Size of Array: ',DllReturn END PROGRAM prgSample
this is the code of the dll function (compiled with Visual Fortran)
Code:
function DllFunc(Array) implicit none Real(4),intent(in) :: Array(:) Real(4) :: DLLFUNC DllFunc=Size(Array) end function
when i run the program, it prints "Size of Array: 4" although it's 10.
if i compile the dll with same compiler it works. Is there any possibility of array descriptor structure of the compilers wouldn't be same ?
Or maybe, Visual Fortran compiler default expects a normal array reference not a descriptor reference from the outside calls ?
I'm really stuck here therefore any help would be great. Thanks in advance.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The array descriptors are not the same. Close, but not compatible. An alternative is to pass the array length as a separate argument and use "adjustable arrays" such as this:
function DllFunc(Array,N)
implicit none
Integer(4), intent(in) :: N ! Must be declared first!
Real(4),intent(in) :: Array(N)
Real(4) :: DLLFUNC
DllFunc=Size(Array)
end function

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