Can you explain why this doesn't work?
DLL ft95test.dll:
subroutine greeter(num) integer(kind=3), intent(in) :: num assembly_interface (name='greeter') print *, 'Hello ', num end subroutine
subroutine greeter2(greetee) character(len=*), intent(in) :: greetee assembly_interface (name='greeter2') print *, 'Hello ', greetee end subroutine
(compiles without problems)
C# Program (Console application): (references the dll)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Salford.Fortran;
namespace TestFortran { class Program { static void Main(string[] args) {
int number = 99;
string programmer = 'Thomas';
ft95test.GREETER(number);
ft95test.GREETER2(programmer, programmer.Length);
Console.ReadLine();
}
}
}
Error 3 The best overloaded method match for 'ft95test.GREETER(int*)' has some invalid arguments D:\Visual Studio 2008\Projects\F95Projects\Ft95Test\TestFortran\Program.cs 17 13 TestFortran Error 4 Argument '1': cannot convert from 'int' to 'int*' D:\Visual Studio 2008\Projects\F95Projects\Ft95Test\TestFortran\Program.cs 17 30 TestFortran Error 5 The best overloaded method match for 'ft95test.GREETER2(Salford.Fortran.Character*, int)' has some invalid arguments D:\Visual Studio 2008\Projects\F95Projects\Ft95Test\TestFortran\Program.cs 18 13 TestFortran Error 6 Argument '1': cannot convert from 'string' to 'Salford.Fortran.Character*' D:\Visual Studio 2008\Projects\F95Projects\Ft95Test\TestFortran\Program.cs 18 31 TestFortran
If I'm not passing the Length argument, I get the message that there is no version of Greeter2 with only one argument.
Why does Fortran want pointers? I think the conversion is done through the Assembly_interface? If I try to pass arguments by reference it doesn't help.
😮