C / C++ SDK
RBS provides native C and C++ support with compilation, linking, shared library management, and hermetic launcher scripts that handleLD_LIBRARY_PATH / DYLD_LIBRARY_PATH automatically.
Rules
C Rules
c_library
Creates a C static library (object archive).
| Attribute | Type | Description |
|---|---|---|
name | string | Unique target name (required). |
srcs | list | C source files (.c). |
hdrs | list | Header files (.h). |
deps | list | Dependencies (c_library or c_shared_library). |
cflags | list | Extra compiler flags (e.g., -O2, -Wall). |
c_shared_library
Creates a C shared library (.so / .dylib).
c_binary
Creates an executable C binary with a hermetic launcher script.
| Attribute | Type | Description |
|---|---|---|
name | string | Unique target name (required). |
srcs | list | C source files. |
hdrs | list | Header files. |
deps | list | Dependencies. |
cflags | list | Compiler flags. |
ldflags | list | Linker flags. |
C++ Rules
cxx_library
Creates a C++ static library.
| Attribute | Type | Description |
|---|---|---|
name | string | Unique target name (required). |
srcs | list | C++ source files (.cpp, .cc). |
hdrs | list | Header files (.h, .hpp). |
deps | list | Dependencies. |
cxxflags | list | C++ compiler flags. |
cxx_shared_library
Creates a C++ shared library.
cxx_binary
Creates an executable C++ binary.
Shared Library Handling
When ac_binary or cxx_binary depends on shared libraries, RBS automatically:
- Copies shared libraries into the target’s
runfiles/lib/directory. - Generates a launcher script that sets
LD_LIBRARY_PATH(Linux) andDYLD_LIBRARY_PATH(macOS) to point to the bundled libraries.