Download MetaTrader 5
To add comments, please log in or register
Add the thread to Favorites. Track the changes even faster!
cxan_96
14
cxan_96 2015.03.12 15:33 

Hello community, this is my first topic.

 I am trying to build my own DLL for Metatrader 5 using C++ and Microsoft Visual Studio Community 2013.
I just coded this simple function here:

 

#include <string>


using namespace std;


#define _DLLAPI extern "C" __declspec(dllexport)


_DLLAPI string __stdcall test() {

return "test";

}

 And exported it as a .DLL file. When I want to import it to use it in my EA, I end up getting weird errors like this: 

2015.03.12 15:21:13.761 JavaBridge (EURUSD,H1) Access violation at 0x000007FEFB071276 write to 0x0000000000000018 in 'C:\...\MetaTraderTest.dll'

2015.03.12 15:21:13.771 JavaBridge (EURUSD,H1)   crash -->  000007FEFB071276 48C741180F000000  mov        qword [rcx+0x18], 0xf

Do you have a solution? I tried Google but it didn't help.

Thank you in advance!

Chris 


InvestSoft
7793
Janusz Trojca 2015.03.12 17:31  
cxan_96:

Hello community, this is my first topic.

 I am trying to build my own DLL for Metatrader 5 using C++ and Microsoft Visual Studio Community 2013.
I just coded this simple function here:

 

#include <string>


using namespace std;


#define _DLLAPI extern "C" __declspec(dllexport)


_DLLAPI string __stdcall test() {

return "test";

}

 And exported it as a .DLL file. When I want to import it to use it in my EA, I end up getting weird errors like this: 

2015.03.12 15:21:13.761 JavaBridge (EURUSD,H1) Access violation at 0x000007FEFB071276 write to 0x0000000000000018 in 'C:\...\MetaTraderTest.dll'

2015.03.12 15:21:13.771 JavaBridge (EURUSD,H1)   crash -->  000007FEFB071276 48C741180F000000  mov        qword [rcx+0x18], 0xf

Do you have a solution? I tried Google but it didn't help.

Thank you in advance!

Chris 


What version of MetaTrader do you use (32-bit or 64-bit)? Can you send MetaTraderTest.dll?
cxan_96
14
cxan_96 2015.03.12 21:12  
forex_trader:
What version of MetaTrader do you use (32-bit or 64-bit)? Can you send MetaTraderTest.dll?

First: Thank you for your help, I appreciate it very much!

I am currently using Metatrader 5 Version 5.00 Build 1085 64-bit and I will attach the .dll file. 

Greetings

Chris 

In case the Attach file option does not work:

https://dl.dropboxusercontent.com/u/34688380/MetaTraderTest.dll 

Alain Verleyen
Moderator
28659
Alain Verleyen 2015.03.12 22:40  
cxan_96:

First: Thank you for your help, I appreciate it very much!

I am currently using Metatrader 5 Version 5.00 Build 1085 64-bit and I will attach the .dll file. 

Greetings

Chris 

In case the Attach file option does not work:

https://dl.dropboxusercontent.com/u/34688380/MetaTraderTest.dll 

You can't return a string this way.

https://www.mql5.com/en/forum/7386

InvestSoft
7793
Janusz Trojca 2015.03.13 12:05  

Function test() should return wchar_t* value instead of string:

extern "C" __declspec(dllexport) wchar_t* __stdcall test()
{
 return (L"test");
} 
/
To add comments, please log in or register