I'm new to ProtocolBuffer. Until now all is going ok with Protocol
Buffers for my needs.

But, now I'm struggling for a while with a Message->New issue without
a clue.

I'm trying to create "concrete" messages, which are known at runtime
using DynamicMessageFactory (C++). Following is the pseudo-code

const Descriptor* descriptor = ConcreteMessage::descriptor();
//or const Descriptor* descriptor = DescriptorPool::generated_pool()-
>FindMessageTypeByName("ConcreteMessage") ;

DynamicMessageFactory messageFactory;
Message* message = messageFactory.GetPrototype(descriptor);
ifstream input("ZZZ", ios::in | ios::binary);
ConcreteMessage* concreteMessage = reinterpret_cast<ConcreteMessage*>

Message is created, works and encoded fine. Accessing methods through
Reflection works fine (DebugString() shows ok, which uses internally

However, accessing this ConcreteMessage through the "accessor" methods
generated automatically by protoc.exe compiler in
ConcreteMessage.pb.cc (i.e ConcreteMessage.has_XXXX,
ConcreteMessage.XXXXX(), ConcreteMessage.mutable_XXXXX()) doesn't
works at all.

What I have seen is that the properties defined in this automatic
generated class are not updated when ParseFromIstream is executed. I
would say that even other methods in this class are not being called
from ParseFromIstream (i.e. Clear()...).

Is this something not supported or am I missing something?

Any comment will be appreciated


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to