Sie verpassen Handelsmöglichkeiten:
- Freie Handelsapplikationen
- Über 8.000 Signale zum Kopieren
- Wirtschaftsnachrichten für die Lage an den Finanzmärkte
Registrierung
Einloggen
Sie stimmen der Website-Richtlinie und den Nutzungsbedingungen zu.
Wenn Sie kein Benutzerkonto haben, registrieren Sie sich
Hey all,
maybe you could help me solving this problem. I have create a simple DLL, like as described here:
https://www.mql5.com/de/articles/18
The DLL work when i use as parameter a Integer but when i switch to string, MT5 come up with the message, he couldn't find the method:
2017.11.18 11:24:35.507 Test(EURUSD,M1) Cannot find 'testWchar_Ref' in 'Test\variableTest.dll'
This is my import in MT5:
void testInt_Ref (int &intTest_ref);
void testWchar_Ref (string &wchar_tTest_Ref);
#import
Implementation in MT5:
int myInt = 0;
testInt_Ref(myInt);
Print("New INT: ", myInt );
Print("PRE: " + stringTest);
testWchar_Ref(u_stringTest);
Print("POST: " + stringTest);
Export in DLL:
#define QVAR_API __declspec(dllexport)
#else
#define QVAR_API __declspec(dllimport)
#endif
extern QVAR_API void testInt_Ref(int &intTest_ref);
extern QVAR_API void testWchar_Ref(wchar_t &wchar_tTest_Ptr);
DLL Function:
#include "stdafx.h"
using namespace std;
// add new INT value
void testInt_Ref(int &intTest_ref) {
intTest_ref = 222;
}
// add new WCHAR_T value
void testWchar_Ref(wchar_t &wchar_tTest) {
wchar_t *msg = L"This is cool.....";
wchar_t *wchar_tTest_Ref = &wchar_tTest;
//--- replace it
memcpy(wchar_tTest_Ref, msg, wcslen(msg) * sizeof(wchar_t));
}
Result:
2017.11.18 11:24:35.507 Test(EURUSD,M1) PRE: Hallo you...
2017.11.18 11:24:35.507 Test(EURUSD,M1) Cannot find 'testWchar_Ref' in 'Test\variableTest.dll'
2017.11.18 11:24:35.507 Test(EURUSD,M1) unresolved import function call
it's compiled correctly. In my c++ Testprogram it works. Even when i leave the DLL Method empty it appears. It must be the parameter.
How can i pass a string to a DLL, modify it and use it back in MT5 ?
Thanks in Advanced