8000 Fix ODR violations across headers (inline linkage, guards, extern "C") by 60k41p · Pull Request #33 · rl-tools/rl-tools · GitHub
[go: up one dir, main page]

Skip to content

Fix ODR violations across headers (inline linkage, guards, extern "C") - #33

Open
60k41p wants to merge 4 commits into
rl-tools:mainfrom
60k41p:main
Open

60k41p wants to merge 4 commits into
rl-tools:mainfrom
60k41p:main

Conversation

@60k41p
@60k41p 60k41p commented Aug 13, 2026 •
Copy link
Copy Markdown

Header-only library, but dozens of headers defined functions/globals with external linkage and no inline — any binary including them from >1 TU gets duplicate-symbol link errors (or worse, silent per-TU state copies via static).

  • 253fbdf: inline on 19 non-inline free functions in headers (12 files: devices, math, car, persist, inference backends, ui_server, zlib).
  • 95c487a: inline on header globals with external linkage (l2f device/rng/executor/test buffers) and static→inline on executor/debugging-pool helpers + ui_server::http_server.
  • eb3507b: remaining debt — static→inline on ~120 namespace-scope function templates (rl/environments/*, wrappers, mujoco/ant, websocket/gtk callbacks); explicit extern "C" on the 7 C-API definitions; missing #pragma once + include guards added to all 6 C-backend/helper headers; fixed operations_arduino.h reusing the CPU guard macro (it was silently dropped when both were included).
  • Deliberately untouched: static member functions (tensor/gru/polyak Operation::operation) — already implicitly inline, static is API there.

8000
60k41p and others added 4 commits August 13, 2026 15:41
…violations

All functions defined in headers without inline/template/static/constexpr
are ODR violations when included from multiple translation units. This
causes duplicate symbol linker errors.
fix: add inline to 19 non-inline functions in headers to prevent ODR violations
@60k41p 60k41p closed this Sep 16, 2026
@60k41p 60k41p reopened this Sep 16, 2026
@60k41p 60k41p changed the title fix: add inline to 19 non-inline functions in headers to prevent ODR violations Fix ODR violations across headers (inline linkage, guards, extern "C") Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0