Download MetaTrader 5

Write into DLL

To add comments, please log in or register
All articles are available from MetaTrader 5. Contribute your own one!
baza12
15
baza12 2014.02.12 16:59 

I have write into dll

my dll code is :

_DLLAPI void    __stdcall minus( double aaa ,char* g)
  {
    std::ofstream fs(g); 
    fs<<aaa;
    fs.close();
 
  }
 

and my mql5 code is :

#import "MQL5DLLSamples.dll"
void minus(double aaa,string g);
#import
void OnStart()
  {
 minus(96,"C:\\m\\j.txt");
  }
//+------------------------------------------------------------------+

 
why dont work ?

Alain Verleyen
Moderator
30755
Alain Verleyen 2014.02.13 11:38  
baza12:

I have write into dll

my dll code is :

and my mql5 code is :

 
why dont work ?

Please read this article : How to Exchange Data: A DLL for MQL5 in 10 Minutes - MQL5 Articles

The issue is certainly with string versus char. Feel free to ask if it doesn't help you. You can then post error message you got.

baza12
15
baza12 2014.02.13 13:47  
Yes that is the question .last version of MT4 was, now apdayta can pick up how to replace char * in c ++ in string in mql5
Alain Verleyen
Moderator
30755
Alain Verleyen 2014.02.13 13:51  
baza12:
Yes that is the question .last version of MT4 was, now apdayta can pick up how to replace char * in c ++ in string in mql5
Sorry I don't understand your post ?
baza12
15
baza12 2014.02.13 14:10  

this code run in mql4.

in mql5 dont run.

why i replace char* to string

To add comments, please log in or register