Skip to content
Adam
Libraries

Vendored libraries

C libraries built for both targets and linked into your program.

How they ship

Each library ships as a static archive per target, lib<name>.a in res/libs/vendor/<triple>, beside the headers it was built from in res/libs/vendor/include/<name>. Adam's linker puts the code a program calls into the program itself, so no DLL or shared object ships beside the exe.

A library's .C unit names it in each routine's external clause (External declarations): external "zlib" is found as libzlib.a. Most libraries also have an .Ext unit with an Adam API over the C one (C libraries: .C and .Ext):

vendor_zlib.adam
module exe vendor_zlib;

import System.SysUtils, System.Zlib.Ext;

// True when both arrays hold the same bytes
func Same(const AFirst: ByteArray; const ASecond: ByteArray): bool;
var
  LI: int64;
begin
  if len(AFirst) <> len(ASecond) then
    return false;
  end;
  for LI := 0 to len(AFirst) - 1 do
    if AFirst[LI] <> ASecond[LI] then
      return false;
    end;
  end;
  return true;
end;

var
  GData: ByteArray;
  GPacked: ByteArray;
  GBack: ByteArray;
  GError: string;
  GI: int64;

begin
  setlength(GData, 1000);
  for GI := 0 to 999 do
    GData[GI] := uint8(GI mod 10);
  end;
  if ZlibDeflate(GData, ZlibFormat.Gzip, 9, GPacked, GError) then
    println("packed smaller: {}", len(GPacked) < len(GData));
  end;
  if ZlibInflate(GPacked, ZlibFormat.Gzip, GBack, GError) then
    println("same bytes back: {}", Same(GData, GBack));
  end;
end.
output on x86_64-windows-gnu and x86_64-linux-gnu
packed smaller: true
same bytes back: true

The libraries

LibraryRelease, licenseWhat it doesUnits
cmusl v1.2.6, MITAdam's own C library, built with the same flags for every target, so a routine gives the same result on bothSystem.LibC.C (its math.h and string.h routines)
zlibzlib licensedeflate, zlib and gzip dataSystem.Zlib.C, System.Zlib.Ext
minizipzlib licensezip archivesSystem.Minizip.C
yyjson0.13.0, MITJSONSystem.JSON.C, System.JSON.Ext
tomlc17MITTOML v1.0 and v1.1System.TOML.C, System.TOML.Ext
xml2libxml2 v2.15.4, MITXML, XPath, schemas, HTMLSystem.XML.C, System.XML.Ext
raylib6.2, zlib licensewindows, input, 2D and 3D drawing, audioSystem.Raylib.C, System.Raylib.Ext
ravenv0.3.0, Apache-2.0windows of widgets, layout panels and themesSystem.Raven.C, System.Raven.Ext, System.Raven.Raylib
sdl3release-3.4.18, zlib licensewindows, rendering, GPU, input, audio, gamepadsSystem.SDL3.C
sdl3_mixerrelease-3.2.4, zlib licensemixing tracks decoded from WAV, FLAC, MP3, Ogg Vorbis and MIDISystem.SDL3_mixer.C
mojoalzlib licenseOpenAL 1.1 over SDL3's audioSystem.MojoAL.C
pl_mpegMITMPEG-1 video and MP2 audioSystem.pl_mpeg.C

A library is searched in each module's @addlibrarypath folders, in module and directive order (Directives), then in res/libs/vendor/<triple> and res/libs/system/<triple> beside adam.exe, then where the target's OS keeps its own.

res/libs/system/<triple> holds what the OS provides: on x86_64-windows-gnu its import libraries (kernel32.lib and the rest), on x86_64-linux-gnu .abi tables naming each symbol's version and shared library for glibc and libX11.

↑ ↓ moveEnter openEsc close