From 0ad0d9a65d19a629a78e1fd883e8f57cb8940162 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 3 Nov 2025 11:43:17 -0800 Subject: [PATCH] [orc-rt] Add C API wrap/unwrap functions for Session. These functions provide conversion between Session* and orc_rt_SessionRef. --- orc-rt/include/orc-rt/Session.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/orc-rt/include/orc-rt/Session.h b/orc-rt/include/orc-rt/Session.h index c198d374bc849..fe4f07157385f 100644 --- a/orc-rt/include/orc-rt/Session.h +++ b/orc-rt/include/orc-rt/Session.h @@ -17,6 +17,8 @@ #include "orc-rt/ResourceManager.h" #include "orc-rt/move_only_function.h" +#include "orc-rt-c/CoreTypes.h" + #include namespace orc_rt { @@ -69,6 +71,14 @@ class Session { std::vector> ResourceMgrs; }; +inline orc_rt_SessionRef wrap(Session *S) noexcept { + return reinterpret_cast(S); +} + +inline Session *unwrap(orc_rt_SessionRef S) noexcept { + return reinterpret_cast(S); +} + } // namespace orc_rt #endif // ORC_RT_SESSION_H