Comments (24)
@chexiongsheng 重启一下unity解决,😅
from xlua.
luaopen_rapidjson是rapidjson库的符号,看上去你是加pbc吧,你应该调用相应的初始化函数。
你找下luaopen_打头的c函数
from xlua.
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.
你工程的Assets下Plugins下的MacOS/xlua变了么?现在看是没编译进去,没有那符号。
如果没报错应该就是没拷贝过去。
不是plugin_lua53/Plugins/xlua.bundle/Contents/MacOS/xlua,这里是没用的。这是我打包发布包用的。之所以报错是目录没建好,git空目录提交不了,xLua发布到github之前是用svn,这个支持空目录。
from xlua.
我拷贝的是xLua/build/build_osx/Release/xlua.bundle
确定了项目调用的Plugins/xlua.bundle大小和时间也是编译出来最新的
from xlua.
这些文件要一个个添加么?
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.
要一个个加
from xlua.
@LazyPlanet 注意编译win版本的时候,因为c89问题,pbc需要自定义一下bool:
#ifdef _MSC_VER
typedef enum { false = 0,true = !false } bool;
#endif
from xlua.
@wulei 好的,非常感谢,但是我不想用pbc,我是直接用pb来作为发数据格式。
from xlua.
直接用pb是什么意思呢?随便用个pb的lua binding不是挺好的么?客户端一般这块都不会成为性能瓶颈。
from xlua.
就是用protobuff lua 那套作为协议啊?他用的这个pbc 难道不是protoc-c 云风写的那套吗?
好吧,好像是我理解错了。楼主pb的lua binding是啥意思呢?
from xlua.
protoc-c 是云风那个,也有封装成给lua用的支持,(把c库封装一下给lua用就是lua-binding了),楼主就是用那个。
除了云风的,我google搜索第一个是一个很简单的插件,就一个pb.c文件,不像你那个要用到boost啊。
from xlua.
from xlua.
@chexiongsheng 我用boost是因为我要用lua间接读取一些二进制文件,这些二进制文件存储的是protobuff 里面的message序列化的东西,我现在用C++写了一套用于读取这些二进制文件的库,然后将message压到lua表里面,再用lua调用这个库,这个库用到了boost的一些库。 所以...比较尴尬,我需要解决,这个cmakelist如何要加载boost库了。。。
协议这块我是想直接用protobuff-lua这个东西,和wulei用的不太一样。
from xlua.
#ifdef _MSC_VER
typedef enum { false = 0,true = !false } bool;
#endif
楼主,你这个加在哪个文件了啊?
from xlua.
@LazyPlanet 我是加在 pbc.h 里面的
#ifdef _MSC_VER
typedef enum { false = 0,
true = !false } bool;
#endif
from xlua.
我也是加在里面 ,但是pattern.c里面还是报错,没有定义的标识符bool。你还在其他文件加东西了吗? @wulei
from xlua.
好吧,好几个文件都需要加。。 @wulei
from xlua.
@LazyPlanet 我只改了这个地方。
from xlua.
楼主给我个QQ交流啊,请教点东西。。 @wulei
from xlua.
云风这个里面说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.
@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.
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.
➜ 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)
- iOS编译报错 duplicate symbol '_luaopen_bit'
- "SymbolsNotMatchingException" occurs when performing Obfuscator after HotFix Injection.
- 想编译Nintendo Switch平台用的XLua版本 HOT 1
- 鸿蒙平台导出包报错
- ps4平台编译xlua不通过 HOT 1
- 添加HOTFIX_ENABLE宏,在主线程中调用GC.WaitForPendingFinalizers导致死锁,有什么推荐修改方案吗? HOT 4
- 代码里using了UnityEngine.Purchasing.Security命名空间导致Android打包inject失败
- self.gameObject无法访问 HOT 2
- xLua适配 OpenHarmony 平台吗 HOT 1
- Unity2022.3.17发布WebGL后运行报错 HOT 1
- 使用ExampleConfig.cs中的热更新Delegate配置,会使C#方法通过反射调用
- webgl平台下如何自定义异步加载loader HOT 2
- webgl微信小程序打包出现错误,求帮助 HOT 1
- 集成第三方库,在webgl平台要怎么处理? HOT 1
- Xlua中非UnityObject对象销毁问题
- unity2022生成wrap代码时报错 HOT 1
- 无法在包含 IntPtr 的结构体上使用 GCOptimize
- unity2021正常,unity2022,new LuaEnv();就报错。 HOT 1
- 如何将枚举值转换为其基础类型? HOT 1
- 开启了热更新后,游戏内切场景时间多花了3秒,从12秒变成15秒,这个性能正常吗
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xlua.