Support dynamic allocation for string, bytes and message fields.
This is turned on by passing -p to nanopb_generator.py or setting the (nanopb).pointer option for a .proto field. git-svn-id: https://svn.kapsi.fi/jpa/nanopb-dev@1081 e3a754e5-d11d-0410-8d38-ebb782a927b9
This commit is contained in:
committed by
Petteri Aimonen
parent
8e5337e9ef
commit
c66c6b43c4
@@ -15,6 +15,8 @@ Overall structure
|
||||
For the runtime program, you always need *pb.h* for type declarations.
|
||||
Depending on whether you want to encode, decode, or both, you also need *pb_encode.h/c* or *pb_decode.h/c*.
|
||||
|
||||
If your *.proto* file encodes submessages or other fields using pointers, you must compile *pb_decode.c* with a preprocessor macro named *MALLOC_HEADER* that is the name of a header with definitions (either as functions or macros) for *malloc()*, *realloc()* and *free()*. For a typical hosted configuration, this should be *<stdlib.h>*.
|
||||
|
||||
The high-level encoding and decoding functions take an array of *pb_field_t* structures, which describes the fields of a message structure. Usually you want these autogenerated from a *.proto* file. The tool script *nanopb_generator.py* accomplishes this.
|
||||
|
||||
.. image:: generator_flow.png
|
||||
@@ -52,7 +54,7 @@ Features and limitations
|
||||
#) Unknown fields are not preserved when decoding and re-encoding a message.
|
||||
#) Reflection (runtime introspection) is not supported. E.g. you can't request a field by giving its name in a string.
|
||||
#) Numeric arrays are always encoded as packed, even if not marked as packed in .proto. This causes incompatibility with decoders that do not support packed format.
|
||||
#) Cyclic references between messages are not supported. They could be supported in callback-mode if there was an option in the generator to set the mode.
|
||||
#) Limited support for cyclic references between messages. (The cycle must be broken by making one of the references a pointer or callback field, and objects that have circular references are not detected when encoding.)
|
||||
|
||||
Getting started
|
||||
===============
|
||||
|
||||
Reference in New Issue
Block a user