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

Calling Fortran-DLL from vb.net

fobermaier
Beginner
546 Views
Hello everyone,
I have a function that loads a file into memory and returns a reference to that object. The function header looks like this:
logical(2) function CMaToV3Mat( cFile, pMat )
!DEC$ ATTRIBUTES DLLEXPORT, ALIAS:'CMaToV3Mat' :: CMaToV3Mat
use V3MatRow
implicit none
type (T_MATRIX), pointer :: pMat
character(len = *) :: cFile
...
end function

The vb.net declare looks like this:

Private Declare Function CMaToV3Mat Lib "V3MatD.DLL" ( _
ByVal cFile As String, _
ByVal iLenFilename As Integer, _
ByRef hMatrix As Integer _
) As Boolean

During execution I get for both cFile and pMat 'undefined address'. When I use pMat as first argument everything works fine. VB6/CVF6.6C used to accept the original argument order, why does VB.Net/IVF8.1 not or did I miss anything?

Thanks in advance.

Felix Obermaier

0 Kudos
1 Reply
Steven_L_Intel1
Employee
546 Views
I encourage you to read my "white paper" on migrating from CVF to Intel Visual Fortran. It addresses the issues you encountered. Pay close attention to the section on default calling convention changes, in particular the change from STDCALL to C and the change of where string lengths are passed.
0 Kudos
Reply