avatar

Andres Jaimes

Creating a simple static library

This article describes how to create a simple static library using C++. A static library is a collection of object files that are linked with and copied into a target application at compile time. The resulting executable contains all the object code from the static library, so it can be executed independently of the library. Static library Let’s start by creating a simple square class: // src/square.h #ifndef SQUARE_H #define SQUARE_H class square { private: double length; public: square(double length); double area(); }; #endif and its corresponding implementation:

C++20 Modules

In this article, we’ll see how to create and use C++20 modules. We’ll use clang-16 to compile our code. Prerequisites OSX comes with clang-14 by default (2023). We can check its version with the following command: clang --version Apple clang version 14.0.3 (clang-1403.0.22.14.1) Target: arm64-apple-darwin22.5.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin The latest version as of the time of this writing is clang-16. Use the following command to install it with homebrew:

Notes on C++

All the examples use C++17 Sort vector by property in class In this example, we defined a class called open_order that has a long long open_time field, and a constructor. To sort the vector of open_order objects based on the open_time field, we define a comparison function compare_by_open_time that compares two open_order objects based on their open_time values. The function returns true if the open_time of the first object is less than the open_time of the second object, which results in sorting the vector in ascending order of open_time.

Creating a simple dynamic library

This article describes how to create a simple shared library using C++. A shared library is a collection of object files that are linked with and loaded into a target application at runtime. The resulting executable contains only the object code that is needed to load the shared library, for this reason, the library has to be distributed with the executable. Shared library Let’s start by creating a simple sum.c program using C.

Calling a DLL from MQL

There are times when we want access to additional data structures and function libraries than the ones provided by MetaTrader’s MQL. Besides native open-source MQL options, we can create our own Dynamic Link Library (DLL) in C# or C++ and link it to our programs. In this article, we research how to connect to DLLs created with these languages. We must keep in mind that the code generated by C# is managed code running on the .