avatar

Andres Jaimes

Creating C-API Interfaces for C++ code

At some point we’ll want our C++ code to interface with other languages, but since C is the standard, we have to find ways to adapt our C++ code to allow interaction via a C interface. A C API is a group of functions that allows other programs …

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 …

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:

1clang --version
2Apple …

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 …

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 …