我正在尝试使用代码块和 metatrader4 创建一个基本的 hello world dll,并尝试在条纹版本中进行。我编译的 .dll 和 .def 与 .mq4 文件位于同一目录中。
在文件 test.mq4
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
#property strict
//#import "gimmeDLL.dll"
// string GetStringValue(string) define;
//#import
#import "gimmeDLL.dll"
string GetStringValue(string) define;
#import
void OnStart()
{
GetStringValue();
}
在 dll 的 main.cpp 中
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#define MT4_EXPFUNC __declspec(dllexport)
void MT4_EXPFUNC GetStringValue()
{
cout << "Hello, World" << endl;
}
在 gimmeDLL.def 我有
LIBRARY gimmeDLL
EXPORTS
GetStringValue
错误
'define' - semicolon expected marketDump.mq4 6 34
'define' - declaration without type marketDump.mq4 6 34
'GetStringValue' - wrong parameters count marketDump.mq4 11 4