On Wed, Oct 25, 2017 at 1:46 AM, Giri Guntipalli <[email protected]> wrote:
> I am also facing similar issue but problem seems to happen only when > library is complied with -O2 or –Os(optimize for size) with gcc tool chain. > > > > looks like extensions are being treated as dead code and removed by gcc > optimization, any thoughts on overcoming this problem. > The extension has to be explicitly referenced or the linker will strip them out. > > > Thank you > > Giri > On Thursday, 6 June 2013 00:15:14 UTC+5:30, Feng Xiao wrote: >> >> >> >> >> On Wed, Jun 5, 2013 at 2:44 AM, Channakeshava S C <[email protected]> >> wrote: >> >>> I am facing problem in getting protobuf Message with extension from JSON >>> string {"xyz": [1234,2345,3456],"extensions":{"bar": [1,11,111]}} >>> which is generated from Foo. >>> >>> message Foo { >>> repeated int32 xyz = 11; >>> extensions 100 to 199; >>> } >>> >>> extend Foo { >>> repeated int32 bar = 123; >>> } >>> >>> The word "extensions" in the JSON stirng is just added to differentiate >>> with other normal fileds. >>> >>> Now, when I try to deserialize protobuf, i.e protobuf Message from JSON >>> string. Facing difficulty here. >>> >>> fd is NULL, when FindExtensionByName or FindKnownExtensionByName is >>> called . >>> >>> Foo foo; >>> Message *x = &foo; >>> const FiledDescriptor *fd; >>> >>> fd = x->GetDescriptor()->FindExtensionByName("bar") or >>> fd = x->GetReflection()->FindKnownExtensionByName("bar"); >>> >> Is the extension defined in the same .proto file with the message? The >> second one should work. >> >> >>> >>> Could you point out any error in steps which I am following or Is there >>> any other better approach? >>> >>> >>> Thanks, >>> Channakeshava >>> >>> -- >>> 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 post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/protobuf?hl=en. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- > 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 post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
