version: protocolbuffer 3.12.1
in proto:
syntax = "proto3";
import "google/protobuf/descriptor.proto";
package proto;
extend google.protobuf.MessageOptions {
int32 message_id = 59153;
}
message TestMessageId {
option (message_id) = 106;
}
in C#(working)
if (Proto.TestMessageId.Descriptor.CustomOptions.TryGetInt32(59153, out int
messageId))
{
Console.WriteLine("value:{0}", messageId);
}
in C++(not working):
auto message_id =
proto::TestMessageId::descriptor()->options().GetExtension(proto::message_id);
std::cout << message_id << std::endl;
I expect message_id is 106. C# code is working but C++ code always return
0. Is my way is wrong? How can I get message option value in C++?
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/protobuf/74f49fe5-e625-485e-8f14-83809866b110%40googlegroups.com.