6

I am not sure how to represent pointers in protobuf-c.

When there is a structure like the following

struct EXAMPLE1
{
    int32 x;
    int32 *y;
}; 

how would I represent the pointer variable (y) in protobuf-c?

message EXAMPLE1
{    
    int32 x;
    ??  y;
}
brokendreams
  • 827
  • 2
  • 10
  • 29
  • Related: http://stackoverflow.com/questions/17471765/protobuf-message-holding-reference-to-another-message-of-same-type – jpa Jun 27 '15 at 07:47

1 Answers1

5

Pointer values make sense only within one computer and one running application. Protocol buffers is designed to communicate between separate systems, therefore it does not contain a method to transfer pointers.

Instead, put the integer directly in the structure, or find some other way (array index, unique id) to reconstruct the pointer on the receiving end.

jpa
  • 10,351
  • 1
  • 28
  • 45