1) only the server has the right to modify the memory. clients read it.
2)- look at Pipe. there the "events" of data arrival are implemented as self-explanatory - you have data, we take it, we wait for it.
3)yes, you will have to write a server or copy it from MSDN, but ready-made clients can be used directly in MQL5.
4) unfortunately, you can't solve this problem with the polling periodicity. Sleep(1) should not make noise even when working with memory. You should check the timing of functions, maybe there are extra passes and load somewhere.
1 - only a server (written by me from your work)
2 - interesting, I will look only I have a task "as timely as possible" to transfer data 4(8) bytes, i.e. the whole cycle (must be performed very often)
3 - I think by analogy with the article I will make my own, but so far the problem even the test example does not work.
4 - yes, I rewrote some things optimised the code, it seems to be better.
2013.04.01 00:03:49 _tradeBuySell_mt4 GBPCHF,H1: -unknow err(0) h=0
2013.04.01 00:03:49 _tradeBuySell_mt4 GBPCHF,H1: function 'MemOpen' call from dll 'MemMap32.dll' critical error c0000005 at 666013E6.
Here is the code
#include <stdlib.mqh>#define modeOpen 0// open flag#define modeCreate 1// creation flag#import "MemMap32.dll"int MemOpen(string path,int size,int mode,int &err); // open/create file in memory, get handlevoid MemClose(int hmem); // close the file in memoryint MemGrows(int hmem,string path,int newsize,int &err); // increase the size of the file in memoryint MemWrite(int hmem,int &v[], int pos, int sz, int &err); // write int(4) vector v to memory from the specified position pos, size szint MemRead(int hmem, int &v[], int pos, int sz, int &err); // read vector v from the specified position pos with size sz#importint hmem,err; // string file; // file name in memoryint init()
{
file="Local\\123"; // file name in memory
hmem=MemOpen(file,-1,modeOpen,err); // open an existing fileif(hmem>0) // if opened
{
Print("open OK h="+hmem);
}
elseif(err==-2) // if not opened,
{
Print("-err("+err+") memfile not found.");
}
else
{
Print("-unknow err("+err+") h="+hmem);
return(0);
}
Print("OK ("+err+") h="+hmem);
return(0);
}
OK 1 01:10:31 tradeBuySell 'D:\MT5******\MQL5\Libraries\MemMap32.dll' is not 64-bit version
JF 1 01:10:37 tradeBuySell (GBPUSD,H1) Cannot load 'D:\******\MQL5\Libraries\MemMap32.dll'
The x64 version of terminal mt5 is automatically installed on the server.
I have Win7x64 on my laptop, but I have a regular 32-bit version of terminal and it does not try to update to x64 itself.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
1) only the server has the right to modify the memory. clients read it.
2)- look at Pipe. there the "events" of data arrival are implemented as self-explanatory - you have data, we take it, we wait for it.
3)yes, you will have to write a server or copy it from MSDN, but ready-made clients can be used directly in MQL5.
4) unfortunately, you can't solve this problem with the polling periodicity. Sleep(1) should not make noise even when working with memory. You should check the timing of functions, maybe there are extra passes and load somewhere.
1 - only a server (written by me from your work)
2 - interesting, I will look only I have a task "as timely as possible" to transfer data 4(8) bytes, i.e. the whole cycle (must be performed very often)
3 - I think by analogy with the article I will make my own, but so far the problem even the test example does not work.
4 - yes, I rewrote some things optimised the code, it seems to be better.
I tried to add your dll to mt4.
Here is the codeturn the screwdriver right
turn the screwdriver correctly
Your example in the link uses MemMap.dll
It is not there, it is MEmMap32.dll.
It works in mt5, but in mt4 it doesn't find the file.
Initially incorrectly declared err should have been an array, thanks for that
The x64 version of terminal mt5 is automatically installed on the server.
I have Win7x64 on my laptop, but I have a regular 32-bit version of terminal and it does not try to update to x64 itself.