DLL made with c # does not work at mt4.

#1
he DLL made with c # does not work at mt4.

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;
        }
    }
}


  1. Similar Topics

    1. What are these indicators doing or made from?

      1 Replies 199 Views

      by billbroch, Mon Aug 24, 2020 10:00 am in MT4 Indicators

      1 Replies
      199 Views
    2. ATMO52 - based on MM and home made ingredients

      3 Replies 409 Views

      by sizabici, Sat Aug 08, 2020 3:36 am in Trading Journals

      3 Replies
      409 Views

Return to “Coding Help”