From 4a6f09d75b2b62d4e3c5a59fad6ae668fa1e6dcc Mon Sep 17 00:00:00 2001 From: Viacheslav Demydiuk Date: Mon, 8 Jan 2024 22:05:37 +0200 Subject: [PATCH] Set external functions in MT5Connector to be visible for loading DLL --- MT5Connector/MT5Connector.cpp | 12 ++++++------ MT5Connector/Stdafx.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/MT5Connector/MT5Connector.cpp b/MT5Connector/MT5Connector.cpp index f5d1b186..8165e389 100755 --- a/MT5Connector/MT5Connector.cpp +++ b/MT5Connector/MT5Connector.cpp @@ -40,7 +40,7 @@ template T Execute(std::function func, wchar_t* err, T default return result; } -int initExpert(int expertHandle, int port, int isTestMode, wchar_t* err) +_DLLAPI int _stdcall initExpert(int expertHandle, int port, int isTestMode, wchar_t* err) { return Execute([&expertHandle, &port, &isTestMode]() { bool isTesting = (isTestMode != 0) ? true : false; @@ -50,7 +50,7 @@ int initExpert(int expertHandle, int port, int isTestMode, wchar_t* err) }, err, 0); } -int deinitExpert(int expertHandle, wchar_t* err) +_DLLAPI int _stdcall deinitExpert(int expertHandle, wchar_t* err) { return Execute([&expertHandle]() { MtService::GetInstance().DeinitExpert(expertHandle); @@ -58,7 +58,7 @@ int deinitExpert(int expertHandle, wchar_t* err) }, err, 0); } -bool sendEvent(int expertHandle, int event_type, const wchar_t* payload, wchar_t* err) +_DLLAPI bool _stdcall sendEvent(int expertHandle, int event_type, const wchar_t* payload, wchar_t* err) { return Execute([&expertHandle, &event_type, payload]() { MtService::GetInstance().SendEvent(expertHandle, event_type, convertWString(payload)); @@ -66,7 +66,7 @@ bool sendEvent(int expertHandle, int event_type, const wchar_t* payload, wchar_t }, err, false); } -int sendResponse(int expertHandle, const wchar_t* response, wchar_t* err) +_DLLAPI int _stdcall sendResponse(int expertHandle, const wchar_t* response, wchar_t* err) { return Execute([&expertHandle, response]() { MtService::GetInstance().SendResponse(expertHandle, convertWString(response)); @@ -74,7 +74,7 @@ int sendResponse(int expertHandle, const wchar_t* response, wchar_t* err) }, err, 0); } -int getCommandType(int expertHandle, int& res, wchar_t* err) +_DLLAPI int _stdcall getCommandType(int expertHandle, int& res, wchar_t* err) { return Execute([&expertHandle, &res]() { res = MtService::GetInstance().GetCommandType(expertHandle); @@ -82,7 +82,7 @@ int getCommandType(int expertHandle, int& res, wchar_t* err) }, err, 0); } -int getPayload(int expertHandle, wchar_t* res, wchar_t* err) +_DLLAPI int _stdcall getPayload(int expertHandle, wchar_t* res, wchar_t* err) { return Execute([&expertHandle, res]() { convertSystemString(res, MtService::GetInstance().GetCommandPayload(expertHandle)); diff --git a/MT5Connector/Stdafx.h b/MT5Connector/Stdafx.h index 2e525d43..e2867f83 100755 --- a/MT5Connector/Stdafx.h +++ b/MT5Connector/Stdafx.h @@ -4,4 +4,4 @@ #pragma once - +#define _DLLAPI extern "C" __declspec(dllexport) \ No newline at end of file