Coder Social home page Coder Social logo

添加第三方库失败 about xlua HOT 24 CLOSED

tencent avatar tencent commented on June 3, 2024
添加第三方库失败

from xlua.

Comments (24)

wulei avatar wulei commented on June 3, 2024 2

@chexiongsheng 重启一下unity解决,😅

from xlua.

chexiongsheng avatar chexiongsheng commented on June 3, 2024

luaopen_rapidjson是rapidjson库的符号,看上去你是加pbc吧,你应该调用相应的初始化函数。
你找下luaopen_打头的c函数

from xlua.

wulei avatar wulei commented on June 3, 2024

pbc暂时你先过滤掉不看,我没有调用呢,现在是luaopen_rapidjson也加不进去,最后调用的是

		LuaEnv luaenv = new LuaEnv ();
		luaenv.AddBuildin ("rapidjson", XLua.LuaDLL.Lua.LoadRapidJson);
		luaenv.DoString ("local rapidjson = require('rapidjson')");

这里都报错:

EntryPointNotFoundException: luaopen_rapidjson
XLua.LuaDLL.Lua.LoadRapidJson (IntPtr L) (at Assets/_LFramework/Script/XLua/LuaDLL.cs:21)
(wrapper native-to-managed) XLua.LuaDLL.Lua:LoadRapidJson (intptr)
XLua.LuaEnv.DoString (System.String chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:206)
Helloworld.Start () (at Assets/XLua/Examples/01_Helloworld/Helloworld.cs:23)

和pbc无关吧

from xlua.

chexiongsheng avatar chexiongsheng commented on June 3, 2024

你工程的Assets下Plugins下的MacOS/xlua变了么?现在看是没编译进去,没有那符号。
如果没报错应该就是没拷贝过去。
不是plugin_lua53/Plugins/xlua.bundle/Contents/MacOS/xlua,这里是没用的。这是我打包发布包用的。之所以报错是目录没建好,git空目录提交不了,xLua发布到github之前是用svn,这个支持空目录。

from xlua.

wulei avatar wulei commented on June 3, 2024

我拷贝的是xLua/build/build_osx/Release/xlua.bundle
确定了项目调用的Plugins/xlua.bundle大小和时间也是编译出来最新的

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

这些文件要一个个添加么?

set (PBC_SRC
pbc/src/alloc.c
pbc/src/array.c
pbc/src/array.c
pbc/src/bootstrap.c
pbc/src/context.c
pbc/src/decode.c
pbc/src/map.c
pbc/src/pattern.c
pbc/src/proto.c
pbc/src/register.c
pbc/src/rmessage.c
pbc/src/stringpool.c
pbc/src/varint.c
pbc/src/wmessage.c
pbc/binding/lua53/pbc-lua53.c
)

难道不是加个目录就可以了吗?

from xlua.

chexiongsheng avatar chexiongsheng commented on June 3, 2024

要一个个加

from xlua.

wulei avatar wulei commented on June 3, 2024

@LazyPlanet 注意编译win版本的时候,因为c89问题,pbc需要自定义一下bool:

#ifdef _MSC_VER
typedef enum { false = 0,true = !false } bool;
#endif

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

@wulei 好的,非常感谢,但是我不想用pbc,我是直接用pb来作为发数据格式。

from xlua.

chexiongsheng avatar chexiongsheng commented on June 3, 2024

直接用pb是什么意思呢?随便用个pb的lua binding不是挺好的么?客户端一般这块都不会成为性能瓶颈。

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

就是用protobuff lua 那套作为协议啊?他用的这个pbc 难道不是protoc-c 云风写的那套吗?

好吧,好像是我理解错了。楼主pb的lua binding是啥意思呢?

from xlua.

chexiongsheng avatar chexiongsheng commented on June 3, 2024

protoc-c 是云风那个,也有封装成给lua用的支持,(把c库封装一下给lua用就是lua-binding了),楼主就是用那个。
除了云风的,我google搜索第一个是一个很简单的插件,就一个pb.c文件,不像你那个要用到boost啊。

from xlua.

chexiongsheng avatar chexiongsheng commented on June 3, 2024

@LazyPlanet

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

@chexiongsheng 我用boost是因为我要用lua间接读取一些二进制文件,这些二进制文件存储的是protobuff 里面的message序列化的东西,我现在用C++写了一套用于读取这些二进制文件的库,然后将message压到lua表里面,再用lua调用这个库,这个库用到了boost的一些库。 所以...比较尴尬,我需要解决,这个cmakelist如何要加载boost库了。。。
协议这块我是想直接用protobuff-lua这个东西,和wulei用的不太一样。

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

#ifdef _MSC_VER
typedef enum { false = 0,true = !false } bool;
#endif
楼主,你这个加在哪个文件了啊?

from xlua.

wulei avatar wulei commented on June 3, 2024

@LazyPlanet 我是加在 pbc.h 里面的

#ifdef _MSC_VER
typedef enum { false = 0,
	       true = !false } bool;
#endif

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

我也是加在里面 ,但是pattern.c里面还是报错,没有定义的标识符bool。你还在其他文件加东西了吗? @wulei

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

好吧,好几个文件都需要加。。 @wulei

from xlua.

wulei avatar wulei commented on June 3, 2024

@LazyPlanet 我只改了这个地方。

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

楼主给我个QQ交流啊,请教点东西。。 @wulei

from xlua.

LazyPlanet avatar LazyPlanet commented on June 3, 2024

云风这个里面说https://github.com/cloudwu/pbc/blob/master/binding/lua/README.md

Install

Make and install protobuf.so ( or protobuf.dll in windows ) and protobuf.lua into your lua path.

这个protobuf.dll是哪里来的啊? @wulei

from xlua.

wulei avatar wulei commented on June 3, 2024

@LazyPlanet 使用CMake 编译以后 protobuf.dll 你就理解为他已经被编译到 xlua.bundle 里面了,如果你是win32 的话就被编译链接到了 xlua.dll中了,然后按照《XLua增加删除第三方lua库.doc》里面调用对应的函数
pbc的在pbc-lua.c中按照文档调用一下:

int luaopen_protobuf_c(lua_State *L)

QQ:151699959

from xlua.

ljz avatar ljz commented on June 3, 2024

EntryPointNotFoundException: luaopen_rapidjson
XLua.LuaDLL.Lua.LoadRapidJson (IntPtr L) (at Assets/XLua/Src/LuaDLL.cs:48)
(wrapper native-to-managed) XLua.LuaDLL.Lua:LoadRapidJson (intptr)
XLua.LuaFunction.Call (System.Object[] args, System.Type[] returnTypes) (at Assets/XLua/Src/LuaFunction.cs:166)
XLua.LuaFunction.Call (System.Object[] args) (at Assets/XLua/Src/LuaFunction.cs:183)
ToDoTest.CallLuaFunc (System.String strFunc) (at Assets/XLua/Tutorial/TODOTest/ToDoTest.cs:311)
ToDoTest.Start () (at Assets/XLua/Tutorial/TODOTest/ToDoTest.cs:150)
我也遇到这个问题了,不知道是怎么回事.

from xlua.

ljz avatar ljz commented on June 3, 2024

➜ build git:(master) ✗ ./make_osx_lua53.sh
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx
=== BUILD AGGREGATE TARGET ZERO_CHECK OF PROJECT XLua WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx/XLua.build/Release/ZERO_CHECK.build/Script-1CE0D092C6784EAB84E29260.sh
chmod 0755 /Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx/XLua.build/Release/ZERO_CHECK.build/Script-1CE0D092C6784EAB84E29260.sh

PhaseScriptExecution CMake\ Rules build_osx/XLua.build/Release/ZERO_CHECK.build/Script-1CE0D092C6784EAB84E29260.sh
cd /Users/apple/Desktop/unity学习文件夹/xlua/build
/bin/sh -c /Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx/XLua.build/Release/ZERO_CHECK.build/Script-1CE0D092C6784EAB84E29260.sh
echo ""

make -f /Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx/CMakeScripts/ReRunCMake.make
make[1]: `/Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx/CMakeFiles/cmake.check_cache' is up to date.

=== BUILD TARGET xlua OF PROJECT XLua WITH CONFIGURATION Release ===

Check dependencies

=== BUILD AGGREGATE TARGET ALL_BUILD OF PROJECT XLua WITH CONFIGURATION Release ===

Check dependencies

Write auxiliary files
write-file /Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx/XLua.build/Release/ALL_BUILD.build/Script-8E3AF41F801B473FADB3732E.sh
chmod 0755 /Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx/XLua.build/Release/ALL_BUILD.build/Script-8E3AF41F801B473FADB3732E.sh

PhaseScriptExecution CMake\ Rules build_osx/XLua.build/Release/ALL_BUILD.build/Script-8E3AF41F801B473FADB3732E.sh
cd /Users/apple/Desktop/unity学习文件夹/xlua/build
/bin/sh -c /Users/apple/Desktop/unity学习文件夹/xlua/build/build_osx/XLua.build/Release/ALL_BUILD.build/Script-8E3AF41F801B473FADB3732E.sh
echo ""

echo Build\ all\ projects
Build all projects

** BUILD SUCCEEDED **

➜ build git:(master) ✗

from xlua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.