.

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. could you check why it does not work?

      5 Replies 528 Views

      by Themilliondollar, Thu Nov 22, 2018 4:39 am in Coding Help

      5 Replies
      528 Views
    2. Survivor EA don't work

      3 Replies 711 Views

      by pin12, Thu Aug 30, 2018 1:01 pm in MT4 Indicators

      3 Replies
      711 Views

Return to “Coding Help”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 2 guests