• 第6月第19天 lua动态链接库(luaopen_*函数的使用) skynet


    1.

    给这个测试库取名为dylib,它包含一个函数add。lua中这样使用:

        local dylib = require "dylib.test"
        local c = dylib.add(1,2)
        print(c)
    上面的dylib.test就是我编译生成的dylib/test.so文件。这个文件该怎么生成?如下:

        int
        luaopen_dylib_test(lua_State* L) {
            luaL_Reg l[] = {
               { "add", *dylib_add* },
               { NULL, NULL },
            };
            luaL_checkversion(L);
            luaL_newlib(L,l);

            return 1;
        }

    http://blog.csdn.net/laozitianxia/article/details/46894883

    2.c++

    http://www.cnblogs.com/lancidie/archive/2011/06/02/2068774.html

    3.skynet

     ./skynet examples/config

     

    ./3rd/lua/lua examples/client.lua

     

     

    http://www.jellythink.com/archives/511

  • 相关阅读:
    用Total Commander for Android管理应用程序
    我的zsh简单设置
    C# Newtonsoft.Json 使用
    Wireshark 抓包 test
    C# 调用API test
    C# 委托 的语法 之一
    C# 对象初始化器 和数组初始化语法
    C 语言 数据类型长度
    vue 使用 test
    test
  • 原文地址:https://www.cnblogs.com/javastart/p/6579529.html
Copyright © 2020-2023  润新知