Memory Mapping - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources
This project (Visual C++ 2010) contains 2 classes - CMemMapApi and CMemMapFile.
They are designed for processing memory mapped files. you can:
Memory mapped files can be used to provide temporary data for Expert Advisors.
The CMemMapApi class is just a wrapper for WinApi functions, and this is the difference between CMemMapFile and CMemMapApi.
CMemMapFile is useful because it provides a file name, a file handle, and controls file size checking. In contrast, the CMemMapApi class can handle multiple memory mapped files.
In the current project, the exported DLL functions are organized in CMemMapApi and are used to handle multiple memory mapped files.
The CMemMapFile class is designed to handle memory mapped files in other C++ projects.
//--- Open/create memory mapped file and return handle integer memory open( string_path , integer_size , integer_mode , integer &err[]); //--- close memory mapped file blankmemoff ( integerum ); //--- Increase the size of the memory mapped file integer memory_grow( integer mmmm, string_path , integer new_size, integer &err[]); //--- Returns the size of the memory mapped file integer memory getsize( integer mmmm, integer &err[]); //--- Set the size of the memory mapped file integer memorySetSize( integer mmmm, integer size, integer &err[]); //--- Write the v vector (size bytes) to the memory mapped file starting at position pos Integer memory write( integer mmmm, integer &v[], integer position, integer size, integer &error[]); //--- Read the v vector (size bytes) into the memory mapped file starting from position pos integer memory read( integer mmmm, integer &v[], integer position, integer size, integer &error[]); //--- Write a string (size bytes) to a memory mapped file starting at position pos Integer MemWriteStr( integer mmmm, string buffer, integer position, integer size, integer & err[]); //--- Read a string (size bytes) from the memory mapped file starting at position pos Integer MemReadStr( integer mmmm, string buffer, integer position, integer & size, integer & error[]);
DLL usage example: market monitoring (memory mapped file)
12.03. 2012: Fixed incorrect writing of strings in Mem
Attachment download
Source: MQL5 #816
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •