I'm trying to integrate protobuf into an existing project's messaging 
framework, which for the most part has been reasonably pain free for 
passing the PB messages around the system.

However, In an effort to avoid too much refactoring when it comes to 
calling the correct handler for each message, I would also like to add some 
code to the generated message classes.

I'm a long way from understanding exactly how at present, but from reading 
the Developer Guide for protobuf::compiler it seems I can implement my own 
plugin to add methods to the classes protoc generates from the .proto files.

Unfortunately, to make the handler calls work as they do currently I would 
also need to add a pure virtual call into google::protobuf::message.h which 
isn't something I really want to do by hand. It's only 1 line of code but 
some time in the future, whenever the protobuf library gets updated, it 
will be overwritten and someone will probably spend a lot of time trying to 
figure out why the build no longer works.

So, is it possible to modify google::protobuf::message with a plugin?

Any additional hints on how to actually go about writing a plugin to inject 
a custom C++ method would also be very much appreciated.


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 post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to