I have the following FORTRAN:
SUBROUTINE MYSUB(MYPARAM)
!DEC$ ATTRIBUTES DLLEXPORT::SetPaths
CHARACTER*50 MYPARAM
WRITE(6, *) MYPARAM
END SUBROUTINE
Then I have the following in C#
class Program
{
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder(50);
sb.Append(@"something");
MYSUB(sb);
Console.ReadLine();
}
[DllImport(@"myCode.dll", EntryPoint = "MYSUB")]
public static extern void MYSUB(StringBuilder input);
}
However, the WRITE in my FORTRAN shows a bunch of junk after "something." Looks like the string terminator is not being honored. Help!