On Thu, Mar 11, 2010 at 2:27 PM, Kenton Varda <ken...@google.com> wrote:

> On the first call to your descriptor() or GetDescriptor() method, you could
> look up the ServiceDescriptor in
> google::protobuf::DescriptorPool::generated_pool().
>

I think that's what my generated code is essentially now doing :

In my generated service_subclass::descriptor() and ::GetDescriptor() methods
I call a 'protobuf_rpc_AssignDescriptorsOnce()' function that looks like
this :

void protobuf_rpc_AssignDesc_test_5fservice_2eproto() {
  const ::google::protobuf::FileDescriptor* file =
    ::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
      "test_service.proto");
  GOOGLE_CHECK(file != NULL);
  TestingService_descriptor_ = file->service(0);
}

GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_rpc_AssignDescriptors_once_);
inline void protobuf_rpc_AssignDescriptorsOnce() {
  ::google::protobuf::GoogleOnceInit(&protobuf_rpc_AssignDescriptors_once_,
                 &protobuf_rpc_AssignDesc_test_5fservice_2eproto);

Andrew 8-)

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@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