You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C++23 module binding for Lua C API: `import mcpplibs.capi.lua;`. Uses xmake as primary build system, GCC 15.1 for C++23 module support.
6
+
7
+
### Environment
8
+
9
+
-**xlings** provides both xmake and GCC 15.1; install via `curl -fsSL https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.sh | XLINGS_NON_INTERACTIVE=1 bash`
10
+
- After installing xlings, run `xlings install gcc@15.1 -y` to get GCC 15.1
11
+
- PATH must include `$HOME/.xlings/bin` and `$HOME/.xlings/subos/current/bin`
12
+
13
+
### Build, test, run
14
+
15
+
Standard commands documented in `README.md`:
16
+
-`xmake f -m release -y` to configure
17
+
-`xmake -y -j$(nproc)` to build
18
+
-`xmake run capi_lua_test` to run tests (97 tests)
19
+
-`xmake run basic|table|function|eval` to run examples
20
+
21
+
### Important caveats
22
+
23
+
-**GCC C++ modules + C headers**: Lua headers must be wrapped with explicit `extern "C"` via `src/capi/lua_headers.h` in the global module fragment. Without this, GCC applies C++ name mangling to the C functions and linking fails. This is a GCC 15.1 behavior with C++ modules.
24
+
-**Interface + implementation split**: The module uses `.cppm` for declarations and `.cpp` for definitions. Functions cannot be `inline` in the `.cppm` because GCC would inline them at the import site where the Lua C declarations are not available, causing link errors.
25
+
-**Lua dependency**: xmake auto-downloads Lua via `add_requires("lua")`. Both `tests/xmake.lua` and `examples/xmake.lua` must include their own `add_requires("lua")` and `add_packages("lua")`.
26
+
-**Test target**: The test target is named `capi_lua_test` (not `templates_test` from the original template).
27
+
-**mcpp style**: Follow [mcpp-style-ref](https://github.com/mcpp-community/mcpp-style-ref). See `.agents/skills/mcpp-style-ref/SKILL.md` for details.
0 commit comments