welder
0.1.0
Bindings for annotated C++ types, from C++26 reflection
Toggle main menu visibility
Loading...
Searching...
No Matches
module.hpp
Go to the documentation of this file.
1
#pragma once
15
#include <
welder/rods/lua/sol2/rod.hpp
>
16
#include <
welder/module.hpp
>
// the backend-agnostic WELDER_MODULE dispatch
17
28
#ifndef WELDER_DETAIL_LUAOPEN_EXPORT
29
# if defined(_WIN32)
30
# define WELDER_DETAIL_LUAOPEN_EXPORT __declspec(dllexport)
31
# else
32
# define WELDER_DETAIL_LUAOPEN_EXPORT __attribute__((visibility("default")))
33
# endif
34
#endif
35
51
#define WELDER_DETAIL_MODULE_ENTRY_sol2(ns, ...) \
52
static void welder_glue_##ns##_sol2(::sol::table&); \
53
extern "C" WELDER_DETAIL_LUAOPEN_EXPORT int luaopen_##ns( \
54
lua_State* welder_lua_state_) { \
55
::sol::state_view welder_lua_{welder_lua_state_}; \
56
::sol::table welder_module_var_{welder_lua_.create_table()}; \
57
using welder_weld_ = ::welder::detail::module_welder_t< \
58
::welder::welder<::welder::rods::sol2::rod> \
59
__VA_OPT__(, ) __VA_ARGS__>; \
60
static_assert( \
61
::std::is_same_v<typename welder_weld_::module_type, ::sol::table>, \
62
"WELDER_MODULE(ns, sol2, W): W must be a welder::welder over a rod " \
63
"whose module handle is sol::table"); \
64
welder_weld_::weld_module<^^ns>( \
65
welder_module_var_, welder_weld_::noop, \
66
[](::sol::table& welder_glue_m_) { \
67
welder_glue_##ns##_sol2(welder_glue_m_); \
68
}); \
69
return ::sol::stack::push(welder_lua_state_, welder_module_var_); \
70
} \
71
static void welder_glue_##ns##_sol2(::sol::table& module)
rod.hpp
welder sol2 Lua rod (header-only).
module.hpp
Rod-agnostic module entry point — the WELDER_MODULE macro.
src
welder
rods
lua
sol2
module.hpp
Generated by
1.17.0