aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Julien Brianceau <jbriance@cisco.com>2016-12-08 13:26:23 +0100
committerGravatar Julien Brianceau <jbriance@cisco.com>2016-12-08 13:28:11 +0100
commitb1295eeffbf2ae7da8a5c7d8601c3ace0663fa09 (patch)
treed3fc0d093520ca6ffc433a525753c84ed1344a02 /src
parentc836ad4dc7db4adf4b42a30474037f712d4f6875 (diff)
C++: export _xxx_default_instance_ symbols
_xxx_default_instance_ symbols are used in inline functions. We have to export them to avoid undefined reference link errors.
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_file.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index bc664c70..d8fda59c 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -403,7 +403,7 @@ class FileGenerator::ForwardDeclarations {
std::map<string, const Descriptor*>& classes() { return classes_; }
std::map<string, const EnumDescriptor*>& enums() { return enums_; }
- void Print(io::Printer* printer) const {
+ void Print(io::Printer* printer, const Options& options) const {
for (std::map<string, const EnumDescriptor *>::const_iterator
it = enums_.begin(),
end = enums_.end();
@@ -422,8 +422,11 @@ class FileGenerator::ForwardDeclarations {
printer->Print(
"class $classname$DefaultTypeInternal;\n"
+ "$dllexport_decl$"
"extern $classname$DefaultTypeInternal "
"_$classname$_default_instance_;\n", // NOLINT
+ "dllexport_decl",
+ options.dllexport_decl.empty() ? "" : options.dllexport_decl + " ",
"classname",
it->first);
}
@@ -433,7 +436,7 @@ class FileGenerator::ForwardDeclarations {
it != end; ++it) {
printer->Print("namespace $nsname$ {\n",
"nsname", it->first);
- it->second->Print(printer);
+ it->second->Print(printer, options);
printer->Print("} // namespace $nsname$\n",
"nsname", it->first);
}
@@ -808,7 +811,7 @@ void FileGenerator::GenerateForwardDeclarations(io::Printer* printer) {
dependency.FillForwardDeclarations(&decls);
}
FillForwardDeclarations(&decls);
- decls.Print(printer);
+ decls.Print(printer, options_);
}
void FileGenerator::FillForwardDeclarations(ForwardDeclarations* decls) {