.NET libraries with "smart" functions import does not work

 

hi all, 


I try to import a C# written DLL as in the example from the release notes.

https://www.metatrader5.com/en/releasenotes/terminal/1898 -> I checked my version and I have 1940.



#import "MQL5Test.dll"

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
  int x=41;
   TestClass::Inc(x);
   Print(x);
//---
   
  }
namespace MQL5Test
{
    public class TestClass
    {
        public static void Inc(ref int x)
        {
            x++;
        }
    }
}

Unfortunately I get now the error:
2018.12.02 11:10:47.258 TestCSharp (EURUSD,H1) function 'MQL5Test.TestClass::Inc' not found in 'C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Libraries\MQL5Test.dll'

2018.12.02 11:10:47.258 TestCSharp (EURUSD,H1) EX5 loading failed


Does anybody know why?

MetaTrader 5 platform build 1930: Floating window charts and .Net libraries in MQL5
MetaTrader 5 platform build 1930: Floating window charts and .Net libraries in MQL5
  • 2018.10.26
  • MetaQuotes Software Corp.
  • www.metatrader5.com
Now you can detach financial symbol charts from the trading terminal window. This feature is convenient when using multiple monitors. Thus, you may set the main platform window on one monitor to control your account state, and move your charts to the second screen to observe the market situation. To detach a chart from the terminal, disable...
 
mbalg:

hi all, 


I try to import a C# written DLL as in the example from the release notes.

https://www.metatrader5.com/en/releasenotes/terminal/1898 -> I checked my version and I have 1940.



Unfortunately I get now the error:
2018.12.02 11:10:47.258 TestCSharp (EURUSD,H1) function 'MQL5Test.TestClass::Inc' not found in 'C:\Users\username\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Libraries\MQL5Test.dll'

2018.12.02 11:10:47.258 TestCSharp (EURUSD,H1) EX5 loading failed


Does anybody know why?

I compiled your library example in two versions of C Sharp, here are the command lines
C:\Windows\Microsoft.NET\Framework64\v3.5\csc /target:library MQL5Test.cs
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc /target:library MQL5Test.cs

in the MT5 Terminal build 1940 everything works fine

2018.12.02 18:00:28.279 TestCSharp (EURUSD,H1)  42
2018.12.02 18:01:29.523 TestCSharp (EURUSD,H1)  42
 
Ivan Negreshniy:
I compiled your library example in two versions of C Sharp, here are the command lines

in the MT5 Terminal build 1940 everything works fine

hi ivan, thanks a lot. i looks very strange i will try it again. many thanks for you help.


Reason: