I think if you have to work with C types then you will need to provide both
a char* and an integer length. That Python error makes it sound like the
Python code is probably trying to parse beyond the end of the serialized
message.

On Wed, Oct 14, 2020 at 3:55 PM Randy Nuss <randall.n...@gmail.com> wrote:

> I am building a C++ library with protobuf messages for consumption by a
> Python program.  The issue is SerializeToString() takes std::string, but
> only c_types (like char*) can be exported by the dll, which results in
> numerical zeros being recognized as string terminators and truncating the
> ParseFromString() process.
>
> I tried using SerializeToArray() but get the following error in Python:
> google.protobuf.message.DecodeError: Field number 0 is illegal.
>
> I would appreciate any suggestions.  Thanks.
>
> --
> 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 protobuf+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/9c3bf578-ba5b-4059-a64b-ec6731690a70n%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/9c3bf578-ba5b-4059-a64b-ec6731690a70n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr5ePaExsM_dvpzJTGmRwafdHb7hXdqG-nnawdQ0%2B4Bb1Q%40mail.gmail.com.

Reply via email to