protocol buffer如何将输出文件编译为DLL

Posted 不言放弃

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了protocol buffer如何将输出文件编译为DLL相关的知识,希望对你有一定的参考价值。

https://github.com/google/protobuf/blob/master/src/google/protobuf/compiler/cpp/cpp_generator.cc

bool CppGenerator::Generate(const FileDescriptor* file,
const string& parameter,
GeneratorContext* generator_context,
string* error) const {
std::vector<std::pair<string, string> > options;
ParseGeneratorParameter(parameter, &options);
// -----------------------------------------------------------------
// parse generator options
// TODO(kenton): If we ever have more options, we may want to create a
// class that encapsulates them which we can pass down to all the
// generator classes. Currently we pass dllexport_decl down to all of
// them via the constructors, but we don‘t want to have to add another
// constructor parameter for every option.
// If the dllexport_decl option is passed to the compiler, we need to write
// it in front of every symbol that should be exported if this .proto is
// compiled into a Windows DLL. E.g., if the user invokes the protocol
// compiler as:
// protoc --cpp_out=dllexport_decl=FOO_EXPORT:outdir foo.proto
// then we‘ll define classes like this:
// class FOO_EXPORT Foo {
// ...
// }
// FOO_EXPORT is a macro which should expand to __declspec(dllexport) or
// __declspec(dllimport) depending on what is being compiled.
//

以上是关于protocol buffer如何将输出文件编译为DLL的主要内容,如果未能解决你的问题,请参考以下文章

如何将文件 .cpp 编译为带有压缩功能的 exe? [关闭]

如何将python脚本编译为二进制可执行文件

如何使 clang 编译为 llvm IR

如何将 .hex 文件反编译为 Arduino 的 C++?

如何在 PHP 中处理 Protocol Buffers 数据

使用 Visual Studio 2017 将 .NET Core 应用程序编译为 EXE 文件