Hi, could you please anybody post some snippet that creates dynamic message
without compiling in C++? I need to create message on runtime and can not
find a way. As far as I read here on forums, it looks like I should use
FileDescriptorProto, but following does not work:
namespace GPB = google::protobuf;
int _tmain(int argc, _TCHAR* argv[])
{
GPB::FileDescriptorProto FDProto;
FDProto.set_package("TestPackage");
FDProto.set_name("TestName");
GPB::DescriptorProto* msgDP = FDProto.add_message_type();
GPB::FieldDescriptorProto* fld = msgDP->add_field();
fld->set_name("Text");
fld->set_type(GPB::FieldDescriptorProto_Type_TYPE_STRING);
string proto =FDProto.DebugString();
GPB::DescriptorPool DscrPool;
const GPB::FileDescriptor * FD = DscrPool.BuildFile(FDProto); // FD is
NULL!!!
}
Thanks, Dusan
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/protobuf/-/_KszGUZQoJAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.