Use this file to discover all available pages before exploring further.
The HELICS C shared library API is exposed through a single header, helics.h, which wraps the entire functionality of HELICS in a stable C ABI. It is the primary interface used by all language bindings (Python, Julia, Java, MATLAB, C#) and is the authoritative driver of HELICS versioning decisions. Any change to the C API is considered a versioning event.The C API uses opaque handle types (HelicsFederate, HelicsPublication, HelicsInput, HelicsEndpoint, etc.) for all objects. Memory lifetime is managed through explicit create/free pairs, and errors are communicated through a HelicsError output parameter rather than exceptions.
Foreign Function Interface (FFI): Language bindings for Python, Julia, MATLAB, Java, C#, and Nim all wrap this API. Building a new binding starts here.
Stable ABI: The C ABI does not change in ways that require recompilation of consumer code within a major version. This makes it suitable for distributing pre-built shared libraries.
Mixed-language processes: When a co-simulation binary is built from multiple languages or compiled independently, the C shared library provides a single well-defined boundary.
Embedding in other runtimes: Simulink, LabVIEW, and similar environments can load shared libraries and call C functions directly.
Every function that can fail accepts a HelicsError* as its last argument. The HelicsError struct carries an integer error code and a descriptive string:
#include "helics/helics.h"HelicsError err = helicsErrorInitialize();HelicsFederate fed = helicsCreateValueFederate("myFed", fedInfo, &err);if (err.error_code != HELICS_OK) { fprintf(stderr, "HELICS error %d: %s\n", err.error_code, err.message); helicsCloseLibrary(); return 1;}// Reset error state for the next callhelicsErrorClear(&err);
Passing NULL as the error pointer causes the library to ignore errors silently. Always initialize the struct with helicsErrorInitialize() before use.
// Get the HELICS version stringconst char* helicsGetVersion(void);// Get build flags and compiler versionconst char* helicsGetBuildFlags(void);const char* helicsGetCompilerVersion(void);// Check if a core type is available in this buildHelicsBool helicsIsCoreTypeAvailable(const char* type);// Abort all activity and terminatevoid helicsAbort(int errorCode, const char* errorString);// Shut down the library (call after all federates are finalized)void helicsCloseLibrary(void);void helicsCleanupLibrary(void);
// Enter initialization mode (blocks until all federates ready)void helicsFederateEnterInitializingMode(HelicsFederate fed, HelicsError* err);// Enter executing mode (blocks until all federates ready)void helicsFederateEnterExecutingMode(HelicsFederate fed, HelicsError* err);// Request time advancement; returns the granted timeHelicsTime helicsFederateRequestTime(HelicsFederate fed, HelicsTime requestTime, HelicsError* err);// Get current granted timeHelicsTime helicsFederateGetCurrentTime(HelicsFederate fed, HelicsError* err);// Finalize the federatevoid helicsFederateFinalize(HelicsFederate fed, HelicsError* err);// Free the federate objectvoid helicsFederateFree(HelicsFederate fed);