BMDX

по-русски >>>
(binary modules data exchange)
A C++ library for exchanging messages and high-level objects between processes and binary modules inside them.


Source code - full: (zip) >>>

Source code - separate files (possibilities of partial including are shown in red):
bmdx_cpiomt.h
arrows1.png
bmdx_config.h
vecm_hashx.h
arrows2.png
bmdx_main.h, bmdx_main.cpp
arch_notes.txt
Source code of the examples: see below >>>

BMDX - features

> Highly efficient data transfer and storage.

> Objects of all main classes of BMDX may be passed by pointer between dynamically loaded libraries
  and main module (executable); object's binary structure behaves correctly everywhere on particular platform,
  independently of the set of compilers used to build the modules.

> For mainstream desktop and mobile platforms, the library supplies a number of wrappers around system API,
  for writing platform-independent code in multitude of everyday programming tasks,
  except for GUI- and network-related.

> Target system architecture: AMD64, x86, arm64-v8a.

> Compatibility with WebAssembly, except for shared memory and multithreading.

> Compatibility with С++98(C99),11,14,17.

> Simplified source code structure (5 files), with possibility of partial including.

> The library is regularly tested with a number of OS and compilers:
  Windows, Ubuntu, FreeBSD, macOS, Solaris, Android, iOS.
  GCC, Clang, MinGW32, MinGW-w64, MSVC, Intel C++, Embarcadero C++, Sun C++.
  (Remark. Some of the above titles refer to official names of companies, registered trademarks and software products.)

BMDX - 10 leading classes

1. dispatcher_mt - address-based message exchange, in- and inter-process.
  Ensures fast transfer of large binary attachments, up to long-term 6..8 GB/s on average 4-core CPU.
  The speed is of same order as in known MPI implementations (MPICH, OpenMPI).
  Allows for direct in-process passing arbitrary user objects, wrapped for proper memory management and locking.

2. unity - polymorphic container for data and objects. Similar to widely known "variant" type.
  In addition to scalars, strings, arrays and user objects, supports two kinds of associative arrays
  and dynamically attachable interfaces for user objects.

3. pcos - in-process common objects storage, accessible from main executable and shared libraries.

4. mod_handle - a wrapper around shared libraries (.dll, .so) handles.

5. hashx - partially ordered hashed associative array.
  Places elements in the order of keys insertion, keeping that order until removal of a key.
  Optimized for fast keys insertion. Integer key insertion takes down to ~55 ns on average PC.

6. cref_t - polymorphic smart pointer. Allows for customized creation and placement of the main object,
  storing hidden auxiliary object in addition to main object,
  customized handlers for reference counting, destruction, deallocation events.

7. critsec_t - a wrapper around standard APIs for locks (pthread_mutex_lock and the like),
  with client-specified wait times.

8. threadctl - a controlling class for CPU thread.
  Supports arguments passing, signal flag, thread priority setting, thread termination (based on system API).

9. vnnqueue_t - non-blocking queue for objects. The supplying and the receiving sides may be in different threads.
  Queued objects are never copied or moved on queue size change.
  Storage place, freed on popping, is automatically reused when necessary.
  The queue supports client-specified capacity fixation and change modes.

10. shmobj2s_t - a wrapper for user object, placed in shared memory.

+. Full API of the library includes also several tens frequently used containers, helper classes and functions.
  Below, there are some of them, with relatively understandable names:
  carray_t, cpparray_t, arrayref_t, processctl, multithread, shmqueue_s, file_io, file_utils, paramline, vec2_t.

BMDX - use examples

Source code - 5 use examples: (zip) >>>

Due to excess of possible applications, the given examples comprise only two key functions -
address-based message sending, and direct calls to objects, passed between binary modules inside a process.
These functions are intended for high-performance applications that are multi-process and/or plugin-based.

Example 1. dispatcher_mt: bulk transfer (message + large binary attachment).
Example 2. dispatcher_mt: "failsafe" propagation of keypress events across the group of terminal windows.
  On stopping or terminating the running example process that plays the role of server,
  one of the remaining processes automatically takes its place.
  (This small example demonstrates message delivery by subscription.)
Example 3. dispatcher_mt: strong-bound call between CPU threads.
  Thread A calls a function, executed by thread B, and waits for the returned value or error code.
Example 4. shmqueue_s: simple data (typed text) transfer via shared memory.
Example 5. Primitive plugin host. The example illustrates high-level interaction of heterogeneous modules
  (i.e. built with different compilers) - the main module (executable) and the dynamically loaded libraries.

BMDX - the plan for future development

1. Extend the message dispatcher with TCP controller and abstract controller,
  to support unified addressable data exchange across the network and non-standard devices,
  in addition to in-computer exchange.

2. Write wrappers for message dispatcher API in certain high-level languages (Java, Python, C#).

Contact info

See e-mail addresses at the top of any header file in the library.