Announcement of cpp-mmf C++ open-source library

In the first days of August I published a stable version of the following project on GitHub:

To install it, press the “Download ZIP” button at the right of its GitHub page, and read the file “manual.html”.

As explained in the Readme page, it is a C++98 (or successive versions) library to encapsulate access to memory-mapped files in every POSIX-compliant operating system (including Unix, FreeBSD, Linux, Mac OS X) and in Microsoft Windows.

For those who don’t know, memory-mapped files are very useful to optimize random access to binary files, and are very convenient because they let you manipulate their contents as if they were byte arrays. The library allow both read-only and read-write file access.

Some people use Microsoft Windows memory-mapped files also for implementing shared memory between processes. The cpp-mmf library is not meant to do that. If you need a platform-independent shared-memory C++ library, use another library, like QT or Boost.

Speaking of Boost, such library collection contains already a platform-independent library for accessing memory-mapped files, but I think it has at least the following shortcomings:

  • It cannot be installed separately, forcing you to install all Boost (around half gigabyte when expanded).
  • It is very slow to compile, because it includes a lot of header files. For example, the recompilation of a small Linux program that uses cpp-mmf takes 0.5 seconds, while the recompilation of an equivalent Linux program that uses Boost takes 2.5 seconds, that is five times as long.
  • It generates large object files and large executable files. For example the above programs, when stripped of debug symbols, is 9 KB long, while the corresponding Boost program is 28 KB long, that is three times as long.
  • It has no tutorial.

My cpp-mmf library is stable, meaning that now I have no intention to change it. Though, I have tested it only with 64-bit Windows 7 (with Visual C++ and GCC compilers) and with 32-bit Linux Mint (with Clang and GCC compilers), and only with small files, i.e. few bytes to few megabytes.

If someone points out a bug, or an important feature missing, or an important platform unsupported, I may change it to satisfy such requests.

Comments and suggestions are welcome, preferably by people who actually uses or wants to use this library.

About Carlo Milanesi

I am a software developer in Italy. I have developed financial, engineering, commercial, web, and industrial automation software using many programming languages, mainly C, C++, Visual Basic, Java, and C#. Now I am interested in Rust.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s