summaryrefslogtreecommitdiff
path: root/xmake/templates/c++/module.shared
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-04 00:52:36 +0800
committerruki <[email protected]>2024-04-04 00:52:36 +0800
commit257bbb3fa4a5c2f47f4a9481ea5a6899aac27a2c (patch)
treec2e8e732ab3696cdefe96ce76d7a600ddeed3bf1 /xmake/templates/c++/module.shared
parentc04f30ad9010b58554554f925584ec97682a3f18 (diff)
replace foo tests
Diffstat (limited to 'xmake/templates/c++/module.shared')
-rw-r--r--xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp27
1 files changed, 11 insertions, 16 deletions
diff --git a/xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp b/xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp
index 579c6646f..a98baca02 100644
--- a/xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp
+++ b/xmake/templates/c++/module.shared/project/modules/shared/foo/src/foo.cpp
@@ -1,8 +1,4 @@
-#include <stdlib.h>
-extern "C" {
-#include <lua.h>
-#include <lauxlib.h>
-}
+#include <xmi.h>
static int add(lua_State* lua) {
int a = lua_tointeger(lua, 1);
@@ -18,15 +14,14 @@ static int sub(lua_State* lua) {
return 1;
}
-extern "C" {
- int luaopen_foo(lua_State* lua) {
- static const luaL_Reg funcs[] = {
- {"add", add},
- {"sub", sub},
- {NULL, NULL}
- };
- lua_newtable(lua);
- luaL_setfuncs(lua, funcs, 0);
- return 1;
- }
+int luaopen(foo, lua_State* lua) {
+ static const luaL_Reg funcs[] = {
+ {"add", add},
+ {"sub", sub},
+ {NULL, NULL}
+ };
+ lua_newtable(lua);
+ luaL_setfuncs(lua, funcs, 0);
+ return 1;
}
+