the following error occurs. I would appreciate if you help.
2018.11.27 17:15:12.066 Libdeneme1 EURUSD,M5: unresolved import function call
2018.11.27 17:15:12.066 Cannot find 'Add' in 'testme.dll'
Edit .... link removed
c# code and mql4 code included.
Code: Select all
#property copyright "Copyright 2010, Investeo.pl"
#property link "http:/Investeo.pl"
#property version "1.00"
#import "Testme.dll"
int Add(int left,int right);
int Sub(int left,int right);
float AddFloat(float left,float right);
double AddDouble(double left,double right);
#import
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
for(int i=0; i<3; i++)
{
Print(Add(i,666));
Print(Sub(666,i));
Print(AddDouble(666.5,i));
Print(AddFloat(666.5,-i));
}
}
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;
namespace Testme
{
public class testme
{
[DllExport("Add", CallingConvention = CallingConvention.StdCall)]
public static int Add([MarshalAs(UnmanagedType.LPWStr)] int left, [MarshalAs(UnmanagedType.LPWStr)] int right)
{
return left + right;
}
[DllExport("Sub", CallingConvention = CallingConvention.StdCall)]
public static int Sub(int left, int right)
{
return left - right;
}
[DllExport("AddDouble", CallingConvention = CallingConvention.StdCall)]
public static double AddDouble(double left, double right)
{
return left + right;
}
[DllExport("AddFloat", CallingConvention = CallingConvention.StdCall)]
public static float AddFloat(float left, float right)
{
return left + right;
}
}
}