Explorar o código

Make building libprotobuf as a DLL work again.

kenton@google.com %!s(int64=16) %!d(string=hai) anos
pai
achega
ccc11678c7

+ 5 - 3
src/google/protobuf/compiler/cpp/cpp_message.cc

@@ -424,10 +424,12 @@ GenerateClassDefinition(io::Printer* printer) {
   // Declare AddDescriptors() and BuildDescriptors() as friends so that they
   // can assign private static variables like default_instance_ and reflection_.
   printer->Print(
-    "friend void $adddescriptorsname$();\n"
-    "friend void $assigndescriptorsname$();\n",
+    "friend void $dllexport_decl$ $adddescriptorsname$();\n",
+    "dllexport_decl", dllexport_decl_,
     "adddescriptorsname",
-      GlobalAddDescriptorsName(descriptor_->file()->name()),
+      GlobalAddDescriptorsName(descriptor_->file()->name()));
+  printer->Print(
+    "friend void $assigndescriptorsname$();\n",
     "assigndescriptorsname",
       GlobalAssignDescriptorsName(descriptor_->file()->name()));
 

+ 18 - 18
src/google/protobuf/descriptor.pb.h

@@ -208,7 +208,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorSet : public ::google::protobuf::Message
   mutable int _cached_size_;
   
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::FileDescriptorProto > file_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
   
@@ -379,7 +379,7 @@ class LIBPROTOBUF_EXPORT FileDescriptorProto : public ::google::protobuf::Messag
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::ServiceDescriptorProto > service_;
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::FieldDescriptorProto > extension_;
   ::google::protobuf::FileOptions* options_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32];
   
@@ -473,7 +473,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto_ExtensionRange : public ::google::proto
   
   ::google::protobuf::int32 start_;
   ::google::protobuf::int32 end_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
   
@@ -628,7 +628,7 @@ class LIBPROTOBUF_EXPORT DescriptorProto : public ::google::protobuf::Message {
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumDescriptorProto > enum_type_;
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::DescriptorProto_ExtensionRange > extension_range_;
   ::google::protobuf::MessageOptions* options_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32];
   
@@ -847,7 +847,7 @@ class LIBPROTOBUF_EXPORT FieldDescriptorProto : public ::google::protobuf::Messa
   ::std::string* default_value_;
   static const ::std::string _default_default_value_;
   ::google::protobuf::FieldOptions* options_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32];
   
@@ -956,7 +956,7 @@ class LIBPROTOBUF_EXPORT EnumDescriptorProto : public ::google::protobuf::Messag
   static const ::std::string _default_name_;
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::EnumValueDescriptorProto > value_;
   ::google::protobuf::EnumOptions* options_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
   
@@ -1062,7 +1062,7 @@ class LIBPROTOBUF_EXPORT EnumValueDescriptorProto : public ::google::protobuf::M
   static const ::std::string _default_name_;
   ::google::protobuf::int32 number_;
   ::google::protobuf::EnumValueOptions* options_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
   
@@ -1171,7 +1171,7 @@ class LIBPROTOBUF_EXPORT ServiceDescriptorProto : public ::google::protobuf::Mes
   static const ::std::string _default_name_;
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::MethodDescriptorProto > method_;
   ::google::protobuf::ServiceOptions* options_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32];
   
@@ -1293,7 +1293,7 @@ class LIBPROTOBUF_EXPORT MethodDescriptorProto : public ::google::protobuf::Mess
   ::std::string* output_type_;
   static const ::std::string _default_output_type_;
   ::google::protobuf::MethodOptions* options_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
   
@@ -1446,7 +1446,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message {
   bool java_multiple_files_;
   int optimize_for_;
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
   
@@ -1545,7 +1545,7 @@ class LIBPROTOBUF_EXPORT MessageOptions : public ::google::protobuf::Message {
   
   bool message_set_wire_format_;
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
   
@@ -1694,7 +1694,7 @@ class LIBPROTOBUF_EXPORT FieldOptions : public ::google::protobuf::Message {
   ::std::string* experimental_map_key_;
   static const ::std::string _default_experimental_map_key_;
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(5 + 31) / 32];
   
@@ -1785,7 +1785,7 @@ class LIBPROTOBUF_EXPORT EnumOptions : public ::google::protobuf::Message {
   mutable int _cached_size_;
   
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
   
@@ -1876,7 +1876,7 @@ class LIBPROTOBUF_EXPORT EnumValueOptions : public ::google::protobuf::Message {
   mutable int _cached_size_;
   
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
   
@@ -1967,7 +1967,7 @@ class LIBPROTOBUF_EXPORT ServiceOptions : public ::google::protobuf::Message {
   mutable int _cached_size_;
   
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
   
@@ -2058,7 +2058,7 @@ class LIBPROTOBUF_EXPORT MethodOptions : public ::google::protobuf::Message {
   mutable int _cached_size_;
   
   ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(1 + 31) / 32];
   
@@ -2156,7 +2156,7 @@ class LIBPROTOBUF_EXPORT UninterpretedOption_NamePart : public ::google::protobu
   ::std::string* name_part_;
   static const ::std::string _default_name_part_;
   bool is_extension_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(2 + 31) / 32];
   
@@ -2295,7 +2295,7 @@ class LIBPROTOBUF_EXPORT UninterpretedOption : public ::google::protobuf::Messag
   double double_value_;
   ::std::string* string_value_;
   static const ::std::string _default_string_value_;
-  friend void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
+  friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
   friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto();
   ::google::protobuf::uint32 _has_bits_[(6 + 31) / 32];
   

+ 1 - 1
src/google/protobuf/extension_set.h

@@ -619,7 +619,7 @@ class RepeatedMessageTypeTraits {
 
 template <typename ExtendeeType, typename TypeTraitsType,
           FieldType field_type, bool is_packed>
-class LIBPROTOBUF_EXPORT ExtensionIdentifier {
+class ExtensionIdentifier {
  public:
   typedef TypeTraitsType TypeTraits;
   typedef ExtendeeType Extendee;

+ 2 - 3
src/google/protobuf/generated_message_reflection.h

@@ -387,12 +387,11 @@ inline To dynamic_cast_if_available(From from) {
 // This is slightly complicated because small strings store their data within
 // the string object but large strings do not.
 LIBPROTOBUF_EXPORT int StringSpaceUsedExcludingSelf(const string& str);
-int StringSpaceUsedExcludingSelf(const string& str);
 
 // Helper for EnumType_Parse functions: try to parse the string 'name' as an
 // enum name of the given type, returning true and filling in value on success,
 // or returning false and leaving value unchanged on failure.
-bool ParseNamedEnum(const EnumDescriptor* descriptor,
+LIBPROTOBUF_EXPORT bool ParseNamedEnum(const EnumDescriptor* descriptor,
                     const string& name,
                     int* value);
 
@@ -409,7 +408,7 @@ bool ParseNamedEnum(const EnumDescriptor* descriptor,
 // Just a wrapper around printing the name of a value. The main point of this
 // function is not to be inlined, so that you can do this without including
 // descriptor.h.
-const string& NameOfEnum(const EnumDescriptor* descriptor, int value);
+LIBPROTOBUF_EXPORT const string& NameOfEnum(const EnumDescriptor* descriptor, int value);
 
 
 }  // namespace internal

+ 0 - 1
src/google/protobuf/repeated_field.h

@@ -94,7 +94,6 @@ class LIBPROTOBUF_EXPORT GenericRepeatedField {
 
 // We need this (from generated_message_reflection.cc).
 LIBPROTOBUF_EXPORT int StringSpaceUsedExcludingSelf(const string& str);
-int StringSpaceUsedExcludingSelf(const string& str);
 
 }  // namespace internal
 

+ 1 - 1
src/google/protobuf/stubs/once.h

@@ -85,7 +85,7 @@ namespace protobuf {
 
 struct GoogleOnceInternal;
 
-struct GoogleOnceType {
+struct LIBPROTOBUF_EXPORT GoogleOnceType {
   GoogleOnceType();
   void Init(void (*init_func)());