On Fri, Aug 28, 2009 at 6:42 PM, Kenton Varda<[email protected]> wrote:
> Ouch, this hole is probably a lot deeper than it looks.
> First let me review some things which you may already know...
> I assume these "plugins" are DLLs.  Do you load and unload these plugins at
> runtime, or just at startup?  If you unload them at runtime, then each one
> needs to be statically linked against its own instance of the protobuf
> library (probably the lite library!), because libprotobuf is not designed to
> allow individual protos to be unloaded without shutting down the entire
> library.  But if each plugin has its own instance, then you cannot pass
> protobuf objects to the plugin.  You can only pass encoded messages, which
> it must parse itself.
> If you do load the plugins for the entire life of the process, then things
> are a little more flexible.  In this case, you can share a single instance
> of libprotobuf among all of them and your app as long as everyone links
> against it as a DLL.  (Though, in this case all plugins must be linked
> against the exact same version of libprotobuf, which may be a problem if
> they are developed by separate groups.)
> Now, getting back to extensions, if you are going with the first option,
> then obviously your app can recognize extensions defined within the plugins,
> because they use a separate instance of libprotobuf.  But it doesn't matter,
> because you have to re-serialize the messages before sending them to the
> plugins anyway, and they will do their own parsing with the extensions
> recognized.
> If you are going with the second option (sharing a common instance of
> libprotobuf), then the plugin *should* have registered its extensions with
> that common instance at startup, and therefore it should be parsing
> correctly.
> To answer your specific question, BTW, yes, you can inspect the contents of
> UnknownFieldSet.  Every message object has methods unknown_fields() and
> mutable_unkown_fields() which return the UnknownFieldSet.  The API is
> described here:
> http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.unknown_field_set.html

Ok, thanks for the detailed explanation. I think I have enough info on
this for the time being.

-- 
/Jesper

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to