Skip to main content

C / C++ SDK

RBS provides native C and C++ support with compilation, linking, shared library management, and hermetic launcher scripts that handle LD_LIBRARY_PATH / DYLD_LIBRARY_PATH automatically.

Rules

C Rules

c_library

Creates a C static library (object archive).

c_shared_library

Creates a C shared library (.so / .dylib).

c_binary

Creates an executable C binary with a hermetic launcher script.

C++ Rules

cxx_library

Creates a C++ static library.

cxx_shared_library

Creates a C++ shared library.

cxx_binary

Creates an executable C++ binary.

Shared Library Handling

When a c_binary or cxx_binary depends on shared libraries, RBS automatically:
  1. Copies shared libraries into the target’s runfiles/lib/ directory.
  2. Generates a launcher script that sets LD_LIBRARY_PATH (Linux) and DYLD_LIBRARY_PATH (macOS) to point to the bundled libraries.
This ensures the binary always finds its shared libraries without requiring system-wide installation.

Example