
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Thanks, useful article!!! Respect!
How to pass a string to C# from MT, I didn't find such a thing in the article. Please explain.
Thanks, useful article!!! Respect!
How to pass a string to C# from MT, I didn't find such a thing in the article. Please explain.
New article Exposing C# code to MQL5 using unmanaged exports has been published:
Author: investeo
Hello investeo, great article!
I've found this article searching on how connect C# DLL on mql5 code... and this helped me a lot! Thanks.
Now, i need to get data from a DLL that runs WebSocket connection with a third party server, and need to send the live data that comes from the server to to MQL5, but i don't found any example of implementation of real time and 2 way communication between MQL5 and a DLL or API.
Can you help me?
Error 2 C:\Users\Administrator\AppData\Local\Temp\tmp8B24\dllTest.il(58) : error : syntax error at token '{ ' in: { dllTest
This error occurs on Chinese systems because UnmanageExports does not work properly because some comments are generated in Chinese when UnmanageExports generates the IL file. This problem does not occur on Japanese and English operating systems, there is a solution, you can change your operating system to an English one.
But this would be too much trouble, right, here you need to take out the little fox thing to fix it!
Download the Unmanaged Exports fix provided by Little Fox at the following address
https://www.noisyfox.cn/397.html
http://www.magecorn.com/p/280.shtml .
For more details, please read the above two articles
The owner of the above code how has not been able to run it?
2017.04.28 23:48:08.774 Cannot find 'Add' in 'Testme.dll'
Switch on "Show all file types" in the editor navigator, grab your DLL with a mouse and throw it into the MQL5 window of the programme.
You will probably be surprised by the result.
Good afternoon. It's 2018....
Can you tell me where I can see examples of calling exported functions written in Net?
You can use C++ stripper with the help of IJW, and then merge everything into one single DLL purely by means of compiler - linker, perversions with the template described in the article are not necessary, described briefly here - http://stackoverflow.com/questions/26226958/include-managed-c-sharp-dll-into-unmanaged-c-dll-all-in-one-single-file.
Well, and the described method with the template RGiesecke - it is a hack and such sooner or later stops working, I, by the way, also did not work ...But, if someone still wants to play with IL method described in the article, there is another bike, though, also not working - https://github.com/winch/winch.pinkbile.com-c-sharp/tree/master/dll_tool/dll_tool.
Good afternoon. Could you write a step-by-step test example of c++/c++CLI/c# assembly in one file? Same simple examples as the author of the article.
Please provide a simple example of a function written in C# to access it from mt4(or mt5) ........... Pass a and b values to a function with Sharp and return the result to mt4(mt5)
in the article https://www.mql5.com/en/articles/249 compiled dll of the author works in mt4 and mt5 correctly!
but when I try to create my own compiled dll from the author's sources (in VisualStudio 2010) this dll doesn't work (writes error 127)
all .NET versions are installed.
// код C#
using System;
using System.Text;
using RGiesecke.DllExport;
using System.Runtime.InteropServices;
namespace TEST
{
class TEST
{
[DllExport("Add", CallingConvention = CallingConvention.StdCall)]
public static int Add(int left, int right)
{
return left + right;
}
}
}
namespace RGiesecke.DllExport
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
partial class DllExportAttribute : Attribute
{
public DllExportAttribute()
{
}
public DllExportAttribute(string exportName)
: this(exportName, CallingConvention.StdCall)
{
}
public DllExportAttribute(string exportName, CallingConvention callingConvention)
{
ExportName = exportName;
CallingConvention = callingConvention;
}
public CallingConvention CallingConvention { get; set; }
public string ExportName { get; set; }
}
}
// код МТ4
//+------------------------------------------------------------------+
#import "TEST.dll"
int Add(int a,int b);
#import
void start()
{
Comment(Add(3,2));
}
//+------------------------------------------------------------------+
I spent three days and three nights googling and experimenting, in general the example works in VS2017, I managed to compile and run .dll under MT4, but ..... under Win10 in Russian I could not run it.
I did the following: installed a virtual machine with Win7 - 64, but in English, installed the English version of VS2017, installed only the package for C#, copied the template from RGiesecke to the folder with templates VS2017. When compiling the project, do not forget to check the platform - necessarily x86 (for MT4) . During the first compilation I got an error no namespace RGiesecke, I installed the UnmanagedExportspackage from the project. Everything compiled with 1 error - ildasm.exe not found, but .dll works under MT4 without problems.
The problem is probably in the template from RGiesecke, it works correctly in English version of Win, in English version of VS2017 and all paths in VS2017 should be set by default.
here's how it works ;)
Does this approach work for .NET version 5?
I haven't tested it, but I doubt it will work
MT4 is very difficult to interact with C# - there are always some pitfalls.
It's easier to switch to MT5.
but if you want to use MT4 in principle, then as an option - launch .dll in C# according to the methodology from the article, and in it launch any C# code in a separate thread and organise the exchange, I have launched 64-bit C# libraries this way