Hello all
I'm a newbie to the forum and somethign of an amatuer - programming is not my primary discipline although I dabble occassionally.
I'm currently trying to interface some Fortran routines into a 3rd party environment by creating a VB.NET DLL. I don't have accessto the Fprtran code because its considered proprietary.
As a starting point, I demonstrated that I could make the call satisfactorily from VBA using the following code:
======================================================
Declare Sub INTERFACE_VB Lib "C:\FortDir\FortFile.dll" _
(ByVal SV As String, ByVal intSV As Long, _
ByRef IV As Long, ByRef RV As Single, ByRef intIERR As Long)
Dim SV As String * 5120
Dim IV(1 To 1280) As Long
Dim RV(1 To 16000) As Single
Dim IERR As Long
[set up arrays]
Call INTERFACE_VB(SV, Len(SV), IV(1), RV(1), IERR)
======================================================
Now, to get the same thing working in .NET, I nede to make some changes:
1. Arrays rebased to 0
2. Use Integer instead of Long because of the change in size
3. No fixed length strings
However, I just can't get the Fortran to return the same values! I have made many attempts, with the following being typical:
======================================================
Declare Sub INTERFACE_VB Lib "C:\FortDir\FortFile.dll" _
(ByVal SV As String, ByVal intSV As Integer, _
ByRef IV As Integer, ByRef RV As Single, ByRef intIERR As Integer)
Dim SV As String
Dim IV(1279) As Integer
Dim RV(15999) As Single
Dim IERR As Integer
[set up arrays]
Call INTERFACE_VB(SV, Len(SV), IV(0), RV(0), IERR)
======================================================
Because I am unable to debug the Fortran I am finding it very difficult to work out where the error is:
- Is it to do with string characters - Unicode vs ANSI?
- Is it to do with array handing?
- Do I need to specify marshaling?
Thanks in advance for any suggestions!
I'm a newbie to the forum and somethign of an amatuer - programming is not my primary discipline although I dabble occassionally.
I'm currently trying to interface some Fortran routines into a 3rd party environment by creating a VB.NET DLL. I don't have accessto the Fprtran code because its considered proprietary.
As a starting point, I demonstrated that I could make the call satisfactorily from VBA using the following code:
======================================================
Declare Sub INTERFACE_VB Lib "C:\FortDir\FortFile.dll" _
(ByVal SV As String, ByVal intSV As Long, _
ByRef IV As Long, ByRef RV As Single, ByRef intIERR As Long)
Dim SV As String * 5120
Dim IV(1 To 1280) As Long
Dim RV(1 To 16000) As Single
Dim IERR As Long
[set up arrays]
Call INTERFACE_VB(SV, Len(SV), IV(1), RV(1), IERR)
======================================================
Now, to get the same thing working in .NET, I nede to make some changes:
1. Arrays rebased to 0
2. Use Integer instead of Long because of the change in size
3. No fixed length strings
However, I just can't get the Fortran to return the same values! I have made many attempts, with the following being typical:
======================================================
Declare Sub INTERFACE_VB Lib "C:\FortDir\FortFile.dll" _
(ByVal SV As String, ByVal intSV As Integer, _
ByRef IV As Integer, ByRef RV As Single, ByRef intIERR As Integer)
Dim SV As String
Dim IV(1279) As Integer
Dim RV(15999) As Single
Dim IERR As Integer
[set up arrays]
Call INTERFACE_VB(SV, Len(SV), IV(0), RV(0), IERR)
======================================================
Because I am unable to debug the Fortran I am finding it very difficult to work out where the error is:
- Is it to do with string characters - Unicode vs ANSI?
- Is it to do with array handing?
- Do I need to specify marshaling?
Thanks in advance for any suggestions!