Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加载模块 luapb失败 #12

Open
oneStarCai opened this issue Aug 24, 2018 · 5 comments
Open

加载模块 luapb失败 #12

oneStarCai opened this issue Aug 24, 2018 · 5 comments

Comments

@oneStarCai
Copy link

lua: error loading module 'luapb' from file './../luapb.so':
libprotobuf.so.9: cannot open shared object file: No such file or directory

@zhanjunxiong
Copy link
Owner

你是不是没有安装protobuf
或者安装的protobuf的版本不对

@oneStarCai
Copy link
Author

你好,现在可以跑起来了。但是还有一点不明白,请教一下:
pb_parseFromString里边调用的是message->ParseFromArray(bin, bin_len); 而pb_serializeToString里边却是调用message->SerializeToString(&msg);
ParseFromArray和SerializeToArray, 以及ParseFromString和SerializeToString不是承兑出现的吗?

@zhanjunxiong
Copy link
Owner

嗯 应该是要像你说的才对。

@oneStarCai
Copy link
Author

如果要用SerializeToArray,lua怎么实现呢?不能使用lua_pushlstring这个函数了吧,有其他函数可以实现这个功能吗?

@zhanjunxiong
Copy link
Owner

我的理解是 SerializeToArray 和 SerializeToString 差不多的
对于lua层来说,都是把string当成数组
你把lua层传进来的string 当成数组处理一下看看吧 应该是一样的效果
当然要考虑会不会string被截断的问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants