Yep, it's a very annoying problem.  The solution I prefer is to add a dummy
usage of one of the classes in your .proto somewhere high-up in your
program, in a place that should logically "know" that the file is needed.
BTW, if you aren't actually explicitly using the extension anywhere, then
the only reason to force it to be linked in is if you want it to appear
correctly when using reflection or TextFormat.  Otherwise you should just
let it go into the UnknownFieldSet.

On Thu, Aug 27, 2009 at 2:17 AM, Jesper Eskilson <jes...@eskilson.se> wrote:

> On Thu, Aug 27, 2009 at 12:18 AM, Kenton Varda<ken...@google.com> wrote:
> > Some linkers will drop object files that aren't referenced from anywhere,
> so
> > if your code doesn't actually use anything from the .proto file defining
> the
> > extension, it might not be linked in, and thus won't be in the registry.
> >  This is one of the common problems that make me wish we had an explicit
> > ExtensionRegistry in C++...
> > Otherwise, I don't know what your problem might be.  If you can narrow it
> > down to a small self-contained example I could debug it.
>
> You're right. I first needed to link all of the *.pb.cc files into
> library doing the parsing, but as you said, MSVC drops the code unless
> I explicitly refer to some code in it.
>
> This is really annoying.
>
> --
> /Jesper
>

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

Reply via email to