我写了这个简单.DLL
的C#
namespace mcMath
{
public class Class1
{
public static double addUp(double num1, double num2)
{
return (num1 + num2);
}
}
}
当我尝试#import
将此.DLL
文件转换为MetaTrader4平台MQL4
代码时,出现错误:
Cannot load 'mcMath.dll' [126]
.
10:55:17.373 Expert fadi EURUSD,H4: loaded successfully
0 10:55:17.689 Expert fadi EURUSD#,H1: loaded successfully
3 10:55:19.224 Cannot load 'mcMath.dll' [126]
0 10:55:19.225 fadi EURUSD,H4: initialized
3 10:55:24.027 Cannot load 'mcMath.dll' [126]
0 10:55:24.028 fadi EURUSD#,H1: initialized
1 10:55:27.463 Cannot call 'mcMath.dll::addUp', 'mcMath.dll' is not loded
1 10:55:27.494 fadi EURUSD#,H1: unresolved import function call
0 10:55:27.522 fadi EURUSD#,H1: uninit reason 4
0 10:55:27.538 Expert fadi EURUSD#,H1: removed
我允许DLL
在平台选项中导入。
Q1:
有人有同样的问题吗?
Q2:
如何解决?
MQL4
代码:
#import "mcMath.dll"
double addUp(double number1,double number2);
#import
double number1, number2;
int OnInit()
{
//---
number1=10.5;
number2=20.3;
double number3= addUp(number1,number2);
Print("the result is: " + number3);
//---
return(INIT_SUCCEEDED);
}