Hi Andrew (or anyone else that can help!),
I've been given a .NET DLL with a simple function in it that I want to call from FTN95. Here's the function declaration:
Public Class FortranDotNetTest
Public Function Calculate(ByVal FirstValue As Integer, ByVal SecondValue As Integer) As Integer
Return FirstValue * SecondValue
End Function
End Class
and here's the function call from within a .NET EXE:
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim objCalculate As FortranDotNetTest.FortranDotNetTest
objCalculate = New FortranDotNetTest.FortranDotNetTest
txtResult.Text = objCalculate.Calculate(CInt(txtValueOne.Text), CInt(txtValueTwo.Text)).ToString
End Sub
Here's what I've tried (using /CLR /CLR_VER 2 in my compile line):
!ftn95$free
!ftn95$LIBRARY 'FortranDotNetTestCOM.DLL'
!ftn95$ASSEMBLY_EXTERNAL ('FortranDotNetTest.FortranDotNetTest.Calculate') MYCALC
PROGRAM ATLAS_TEST
INTEGER I1, I2
I1 = 7
I2 = 4
I3 = ICalculate (I1, I2)
WRITE (*,*) 'Result=',I3
END
FUNCTION ICALCULATE (I1, I2)
I1=7
I2=4
ICALCULATE = MYCALC (I1, I2)
END
But I get these errors at compile time:
ERROR C:\\Atlas\\atlas_test.FOR 24: 1119: No .NET method matches this call
ERROR C:\\Atlas\\atlas_test.FOR 18: 126: Internal compiler error
Obviously, I'm missing a trick, but what is it?
Any advice welcomed.
TIA
K