mql5 and dll C# how to create? - Stack Overflow

How do I create a DLL with functions that can be imported into MetaTrader 5 using C# in Visual Studio 2

How do I create a DLL with functions that can be imported into MetaTrader 5 using C# in Visual Studio 2022?

I tried using this code:

using System;
using System.Runtime.InteropServices;
using RGiesecke.DllExport;

public class MyClass
{
    [DllExport("AddNumbers", CallingConvention = CallingConvention.StdCall)]
    public static int AddNumbers(int a, int b)
    {
        return a + b;
    }
}

and after i create .mql5 and put the dll in the same folder , in library and in include this my code :

#import "MyMQL5DLL.dll"
   int AddNumbers(int a, int b);
#import

void OnStart()
{
   int result = AddNumbers(5, 3);
   Print("The result is: ", result);
}

but unfortunately not work always return me this error:

2025.03.23 15:13:10.720 TEST (XRPUSD,M1) cannot find 'int MyMQL5DLL::AddNumbers(int,int)' in module 'MyMQL5DLL.dll' 2025.03.23 15:13:10.721 TEST (XRPUSD,M1) unresolved import function call in 'TEST.mq5' (1,1)

Anyone have some idea ?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744277289a4566393.html

相关推荐

  • mql5 and dll C# how to create? - Stack Overflow

    How do I create a DLL with functions that can be imported into MetaTrader 5 using C# in Visual Studio 2

    8天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信