Inspirel banner

Programming Distributed Systems with YAMI4

2.1 Core C++ Library

The Core C++ component provides the most basic communication services. It is intended for critical systems and as a basis for the C++ general-purpose part and for the Ada libraries.

This part of the library was written with strict coding conventions that can be appropriate for embedded systems and other similarly limited environments. In particular, the code is compatible to a large extent with the Joint Strike Fighter (JSF) coding standard. In order to support special deployments, a private memory allocator is implemented that can work within the specified memory arena instead of the standard one. The functionality of this component is also minimized and neither thread pools nor message routing are provided out of the box. All these properties mean that the core library might not be appropriate for direct use in general-purpose applications, but expert users and those who need foundations to build support for other programming languages or those who have special requirements for message routing strategies will find this library very useful.

Note:

The core library relies on few but important low-level assumptions related to the representation of fundamental data types on the target platform. In particular, the int type is supposed to be 32-bit and function pointers are expected to have the same representation as object pointers. These assumptions are met by all popular Windows and POSIX-based platforms that are in use today, so should not cause any problems - but at the same time they deserve to be clearly stated.

Even if not used directly, the C++ Core library is necessary for other YAMI4 components and has to be compiled first.

On a Unix-like system the library can be compiled with these commands:

$ cd src/core
$ make

The Makefile file can be modified to allow integration with OpenSSL by activating appropriate settings for the OPTIONS variable. By default the library is compiled without OpenSSL dependency.

The POSIX version of the Core library by default uses the poll system function for socket operations, which is a good choice for mainstream operating systems like FreeBSD or Linux. This function might not be supported on some very limited embedded systems - for such systems the src/core/posix directory contains alternative implementations of some modules that use the more popular select function instead - use file extensions (.poll and .select) to locate appropriate files and use them instead of default ones to choose the proper implementation variant.

On a Windows system with Visual Studio or Visual C++ installed the following should be executed in the VC++ terminal window:

> cd src\core
> nmake /F Makefile.VS

Note that the above Makefile.VS depends on the src\Makefile.VS.common file, which contains settings for local Windows installations - this file should be reviewed and modified as needed. The settings that are related to the C++ Core library are:

Note that by default the SSL integration is disabled and the OPEN_SSL_xxx variables are ignored.

After compilation the include/yami4-core directory (in the root project directory) will be filled with those header files that are supposed to be used by the client code and the lib directory will contain the libyamicore.a or yamicore.lib file for linking in user programs.

A separate Makefile.VS.DLL exists to support creation of DLL library for Windows. In this case the yamicore.dll file is created in addition to the .lib file.

The doc/core directory contains the generated API documentation for this library.