diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc index 099e927a5d5ea..cb0c341553925 100644 --- a/src/google/protobuf/generated_message_util.cc +++ b/src/google/protobuf/generated_message_util.cc @@ -105,6 +105,11 @@ void InitProtobufDefaultsSlow() { PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 static std::true_type init_empty_string = (InitProtobufDefaultsSlow(), std::true_type{}); +const std::string& GetEmptyString() { + InitProtobufDefaults(); + return GetEmptyStringAlreadyInited(); +} + template const T& Get(const void* ptr) { return *static_cast(ptr); diff --git a/src/google/protobuf/generated_message_util.h b/src/google/protobuf/generated_message_util.h index d73edc3be7421..989734e57f5d5 100644 --- a/src/google/protobuf/generated_message_util.h +++ b/src/google/protobuf/generated_message_util.h @@ -77,10 +77,7 @@ PROTOBUF_EXPORT inline void InitProtobufDefaults() { } // This used by proto1 -PROTOBUF_EXPORT inline const std::string& GetEmptyString() { - InitProtobufDefaults(); - return GetEmptyStringAlreadyInited(); -} +PROTOBUF_EXPORT const ::std::string& GetEmptyString(); // Default empty Cord object. Don't use directly. Instead, call // GetEmptyCordAlreadyInited() to get the reference.