.Net DLL wrapper

 

If anyone can help create a .Net DLL wrapper for MetaQuotes I would be greatly appreciative.

http://www.metaquotes.net/forum/997/

Thanks

 

One thing - I do not think it is impossible to call .Net functions from unmanaged. You can expose these functions througfh COM and call that through unmanaged.

That is what you need to do. I attempted some work there, but time and money was devoted elsewhere...

 

Understandable. I'm going to take a look at it and see how far I can get. I may post my progress here if anyone is able to help out.

 

Today I received a response from MetaQuotes Software Corp about my inquiry.

Their response:

MetaQuotes: "You can create DLL files in any high-level programming language."

Me: "Does this mean .Net DLLs as well?"

MetaQuotes: "Yes, you can. "

I asked for a sample but am not going to wait on it so I will attempt to make a C# DLL by myself. I will post the sample solution if I am successful.

This means a C++ wrapper is not necessary.

 

I don't think that is accurate....maybe clarify how to created pure Managed Code dlls and how to define the entry points....

Unless MetaTrader now has some Managed Code aspect to it - I can't imagine that working directly as they say....

 

Many people have tried C# dlls and failed. I'd be interested if you succeed, since that would change my development as well...

 
dwmcqueen:
I don't think that is accurate....maybe clarify how to created pure Managed Code dlls and how to define the entry points.... Unless MetaTrader now has some Managed Code aspect to it - I can't imagine that working directly as they say....

Your right. I just called them and they confirmed it. He said I need to write a wrapper in C++ to access .NET and that it was not their responsibility to provide a sample. He even had the nerve to give me codersguru's email and told me to ask him for help?!? I told him that was pathetic trying to redirect their support to someone else. I mean don't they provide a product and should therefor provide at least some very basic support?

 

You know I have been meaning to solve this one.

I may have time early next month to take a look, but I could email you what I have.

You also may want to look here -> https://www.mql5.com/en/forum/175924

 

They should have never told you that it was possible. The straightline from MetaTrader should be "unmanaged dlls only".

That way, they wouldn't need to provide any support to someone who wants to bridge the gap.

 

It is very frustrating. When I called yesterday I tried to explain to the guy the common logic that .NET is very popular and they would gain more users but he wouldn't listen. Then I asked him if there will be an API for MT4 and he said spammers caused too many problems for brokers in MT3 so there will be none in MT4. To me that said a lot about where they stand as a company. They are paid by brokers and that's who they work for and will support.

I partly believe that it might be possible to make calls to a .NET dll directly if it is compiled as COM exposed. When I tried to do it MT loaded the dll successfully but failed to call the method. I'd like to help with your effort but it seems that maintaining a wrapper might be a good deal of work. I'd be more motivated if it was 100% .NET. But I can only try the same few variances of calling the .NET dll so many times. The obvious things are that the .NET dll would need to be COM compatible, public and have public static methods. But referencing the namespaces might be where the confusion lies. I just wish I could tell for sure whether MetaQuotes is just being lazy or it is really impossible to use .NET. Does anyone know of any other successful DLL calls made through a language other than C++ such as VB 6 or Delphi?

 

I have heard that proper dlls created in VB6 do work.

One of the problems, and maybe you ran into this with your test, is that the function names get mangled. You need to specify a def file in Visual Studio.

I understand where MetaTrader is coming from. Bridging the Managed and Unmanaged gap is not an easy undertaking. For me, I am actually relieved they don't since that would prevent MetaTrader from running on Linux, OSX, etc. I have seen several other applications (Dreamweaver, for example) that allow .dll plugins but have the same restrictions. As far as not building an API, after all MetaTrader only exists for the brokers. People need to pressure their brokers for an API.