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

Calling function in x64-Fortran-DLL function from VB.NET

fobermaier
Beginner
406 Views
Hello everyone,

i have a problem regarding this function in a fortran-dll:

function RowColGet( pMat, iRegion, iMax, faOrig, faDest, iCountOrig, iCountDest ) result(iRet)
!DEC$ ATTRIBUTES ALIAS: 'V3MatRowColGet' :: RowColGet
!Specified in V3Mat.Def
!!DEC$ ATTRIBUTES DLLEXPORT, ALIAS: 'V3MatRowColGet' :: RowColGet
!DEC$ ATTRIBUTES VALUE :: iRegion, iMax

use ifcom
implicit none

type (T_MATRIX), pointer :: pMat
integer(4), intent(in) :: iRegion, iMax
real(4), intent(out) :: faOrig(0:iMax), faDest(0:iMax)
integer(4), intent(out) :: iCountOrig, iCountDest

integer(4) :: iRet

...
end function
The function definition on VB.Net side is like this:
Friend Declare Function V3MatRowColGet Lib "V3Mat.DLL" ( _
ByRef hMatrix As IntPtr, ByVal iRegion As Integer, ByVal iMax As Integer, _
ByRef asngOrigFirstItem As Single, ByRef asngDestFirstItem As Single, _
ByRef iOrigCount As Integer, ByRef iDestCount As Integer) As Integer
The VB.Net part is compiled in Multi-Platform Mode.

If I run the code on an x86 environment everything works fine, if I run it on an x64 environment this function fails with an access violation.

I wonder if I have to change passing of the real(4) arrays on vb.net side?

Any clues?

Btw, where has the forum search gone?

Thanks in advance
FObermaier
0 Kudos
1 Solution
ArturGuzik
Valued Contributor I
406 Views
Hi,

it might be/might not be related but what about this KB article?

A.

View solution in original post

0 Kudos
3 Replies
ArturGuzik
Valued Contributor I
407 Views
Hi,

it might be/might not be related but what about this KB article?

A.
0 Kudos
Les_Neilson
Valued Contributor II
406 Views

I don't know VB at all but it sounds like it could be a mismatch between 4-byte and 8-byte things (pointers, handles etc)


Quoting - fobermaier

Btw, where has the forum search gone?
It's still there, on the first page, just above Steve's link to attaching files.

Les
0 Kudos
fobermaier
Beginner
406 Views
Quoting - Les Neilson
It's still there, on the first page, just above Steve's link to attaching files.


Thank you, found it.
FObermaier
0 Kudos
Reply