0

I'm currently using protobuf for a project (C++), when I invoke field_count, it correctly returns 5 fields, for that message, but 0 for extensions. I did extend that message, on another file, something along these lines:

File A:

package alpha.proto;

message msg { 
    optional ping ping_field = 10;
    optional pong pong_field = 20;

    extensions 100 to max;
}

File B:

package beta.proto;

import "fileA.proto";

message delta_request {
    required int32 num = 10
}

extend alpha.proto.msg {
    optional delta_request delta_request_field = 110;
}

...

Does anyone know what the cause for returning zero as extension_count could be? Thank you.

Prozak
  • 1
  • 1
  • Which descriptor were you calling extension_count on? Because you declared the extension at the top level, it would be in the `FileDescriptor`, not the `Descriptor` – Dave S Jul 01 '16 at 11:20
  • Let me check, thx for the reply... – Prozak Jul 01 '16 at 12:58
  • I tried using the FileDescriptor, but it also did not return the extensions present on file B, package beta.proto. Is it because I'm naming packages in File A as one thing, and as another in File B? Do I need to name the package as alpha.proto in file B? Very confused here... – Prozak Jul 02 '16 at 20:08

0 Answers0