Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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 ×[]);
#import
void TestLong() {
long tlong[3]= {1111111,22222222,33333333};
TestFill(Terminal.CommonDataPath(), daytimes);
}
Any help....thanks..