MDF4-Lib

A free C++ library for reading and writing ASAM-MDF4 files

Last update: Feb 19, 2021

ASAM – MDF4.x File Format

The MDF4 standard format was created by ASAM e.V. to hold a variety of data acquisition data. Almost any type of data layout can be described in MDF4 formats. MDF4 is fully 64 bit wide and allows to compress data in an extremely effective way (v 4.1). The basic layout of a MDF4 is a fixed file header, followed by a variable file header. The rest of the file is organized in numerous types of blocks, which are linked together. These blocks can hold comment texts, signal descriptions, data block descripts and much more.

What is the MDF-LIB?

Part one is a C++ class which allows low level access for reading and creating all types of MDF4 blocks. It can be compiled with almost all versions of Microsoft Visual Studio. A base implementation for Linux compilers is also available.

Part two offers two COM objects which can be used to read or write MDF4 files from all languages which support COM objects. These implementations allow only high level access to the underlying MDF4 structure, but most of the task in data acquisition can be done using these COM objects. There is also a short documentation.

Can I use the MDF-LIB freely?

Yes, the lib was created to encourage all software developers to use the MDF4 format. To achieve this goal, it is important that the usage of the lib is free from any limitations. Please read the license statement in the mdf4.h file for details.

If you use the MDF4 C++ classes in your application you must be a member of ASAM e.V. or purchase the standard from ASAM e.V.. However, the use of the COM objects MDF4Writer and MDF4Reader is free and does not require ASAM membership.

Download files (Windows):

MDF4 Lib C++:    Download v 2.021   Simple example   Writer example appending data

The C++ source code of the MDF4 classes.

MDF4 Viewer:    Download

An example for the usage of the MDF4 lib (VC2010, VC2013, VC2015). MDF Viewer is an MFC-based Windows program which lists the contents of the most commonly used block types in an Explorer-like view.   

MDF4 Reader:    Download v 1.0.0.21

A COM library for reading MDF4 and MDF3 data files. A caller example program is included. The ZIP contains two versions of the COM object: one is Win32, the other x64.              

MDF4 Writer:    Download v 1.0.0.31

A COM library for writing MDF4 data files. It also has an ordinary C interface, if COM should be avoided. A caller example program is included. The ZIP contains two versions of the DLL: one is Win32, the other x64.

Download files (Linux):

MDF4 Lib C++:    Download v 2.020 with examples

The C++ source code of the MDF4 classes including Linux 2 examples.