Pass data to c# dll with SizeParamIndex = 0

 

Hi all, I am trying to pass data type long exactly timestamp to c# dll but it's gives only one value or zero value ... I don't why.... here is my code 

c#

public class ExportAll

    {

        [DllExport("TestFill", CallingConvention = CallingConvention.StdCall)]

        public static int TestFill (

            [MarshalAs(UnmanagedType.LPWStr)] string common_path,

            [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0,ArraySubType = UnmanagedType.I8), In, Out] long[] times)

        {

            int originalCodePage=0;

            try

            {

                if (originalCodePage == 0)

                    originalCodePage = Encoding.Default.CodePage;

                string str = Encoding.GetEncoding(originalCodePage).GetString(Encoding.GetEncoding(1252).GetBytes(common_path));

                Directory.CreateDirectory(str);

                Logger.SetLogPath(str);

                Logger.Info($"times length {times.Length}");

                for (int i = 0; i < times.Length; i++)

                {

                    Logger.Info($"time is {times[i].ToString()}");

                }

                return 0;

            }

            catch (Exception ex)

            {

                Logger.OnException(ex);

            }

            return -1;

        }

}

mql4

#import "ClassLibraryTest.dll"

int TestFill(string,long &times[]);

#import


void TestLong() {

   long tlong[3]= {1111111,22222222,33333333};

   TestFill(Terminal.CommonDataPath(), daytimes);

}


Any help....thanks..

Reason: