Need help , in passing passing C# string to FORTRAN 77 dll as argument.
FORTRAN 77 code:
*$pragma aux CHARIN "CHARIN" export parm(value)
SUBROUTINE CHARIN(FCHAR)
C Declarations
CHARACTER*(*) FCHAR
C
PRINT*,FCHAR
C
RETURN
END
C# code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
[DllImport("fdchar.dll",
CharSet = CharSet.Auto,
CallingConvention = CallingConvention.StdCall)]
static extern void returnDecay(
[MarshalAs(UnmanagedType.LPStr)]string FCHAR,
int tint);
static void Main(string[] args)
{
string ccc = "ABCD";
int tint = 4;
CHARIN(ccc,tint);
Console.Write("Press any key to EXIT");
Console.ReadKey(false);
}
}
}