> How else should be do it?
This is the entire patch I use for statically linked Lua:
diff --git a/src/luaconf.h b/src/luaconf.h
index fd447cc..49e127c 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -251,7 +251,11 @@
#else /* }{ */
+#ifdef __cplusplus
+#define LUA_API extern "C"
+#else
#define LUA_API extern
+#endif
#endif /* } */
It is similar to your approach. In the past, I used some other ways, but eventually I settled on this. Repeat, statically linked Lua.
Cheers,
V.