To connect to a server, I need to use Google's Protocol Buffer format.
The only workable parser to convert the protocol definition file to
pascal reader/writer source code is:
the ProtoBufCodeGen in
https://github.com/fundamentalslib/fundamentals5/releases
Still, there is no documentation on how to call the generated codes.
For example, it generated these:
procedure RequestRecordInit(var A: TRequestRecord);
procedure RequestRecordFinalise(var A: TRequestRecord);
function pbEncodeDataRequestRecord(var Buf; const BufSize: Integer;
const A: TRequestRecord): Integer;
function pbDecodeValueRequestRecord(const Buf; const BufSize: Integer;
var Value: TRequestRecord): Integer;
function pbEncodeFieldRequestRecord(var Buf; const BufSize: Integer;
const FieldNum: Integer; const A: TRequestRecord): Integer;
procedure pbDecodeFieldRequestRecord(const Field:
TpbProtoBufDecodeField; var Value: TRequestRecord);
I could call pbEncodeDataRequestRecord to convert the TRequestRecord to
a stream of byte and store in the Buf
but there is not a routine to convert it back from a stream of bytes to
the TRequestRecord.
The only seemingly useful routine pbDecodeValueRequestRecord, when
called with the Buf generated by pbEncodeDataRequestRecord will raise
exception "Invalid buffer "
Any help?
Dennis
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal