在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):indygreg/lua-protobuf开源软件地址(OpenSource Url):https://github.com/indygreg/lua-protobuf开源编程语言(OpenSource Language):Python 100.0%开源软件介绍(OpenSource Introduction):lua-protobuf provides a Lua interface to Google's Protocol Buffers. Producing Codelua-protobuf provides a plugin for the protoc protocol buffer compiler (it ships with protocol buffers). This plugin tells protoc to produce a set of C++ output files, which define the Lua interface to protocol buffers using the Lua C API. First, obtain a copy of lua-protobuf:
Next, install lua-protobuf:
Yes, lua-protobuf is written in Python (for now at least). Finally, launch protoc and tell it to produce Lua output:
You simply need to add --lua_out to the arguments to protoc to get it to produce the Lua output files. Under the hood, protoc is looking for the program protoc-gen-lua somewhere in your $PATH. You can modify $PATH in lieux of installing the package, if you desire. Missing plugin_pb2 Python ModuleThe protocol buffers Python installer does not install a file required by protoc-gen-lua at this time. The missing file is the Python interface to the compiler plugin plugin.proto. The protoc-gen-lua Python script may fail when importing the google.protobuf.compiler.plugin_pb2 module. A thread on the protocol buffers mailing list discusses the issue. At this time, the issue can be worked around by manually installing the missing file. Assuming you have a working protoc compiler on your system and have the existing Python protocol buffers package installed, from the protocol buffers source code directory, run the following:
The command should produce no output if successful. Additionally, the file /path/to/output/directory/google/protobuf/compiler/plugin_pb2.py should have been created. Next, find the location of the installed protocol buffer Python package. If you have locate, try finding it via
In common English:
Depending on the installed location of protocol buffers, these actions may require superuser or administrator privileges. Compiling Produced FilesYou should be able to compile the produced .h and .cc files like you would for protocol buffer output files. If you have an existing Makefile, project, etc, just add the produced .h and .cc files to it. For linking, you'll need to include whatever library contains Lua. On *NIX toolchains, this typically corresponds to the linker flag -llua or -llua5.1. The produced C++ code contains extern "C" { } blocks around all code that utilizes Lua API function calls to avoid C++ name mangling. WindowsWindows requires an identifier for symbols to be exported from shared libraries. If compiling the lua-protobuf output to a shared library, you'll need to use a preprocessor define:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论