Thanks a lot for the reply.
Gokul.
On Tue, Jul 12, 2011 at 3:23 PM, Pherl Liu liuj...@google.com wrote:
In the common.h, we have a using namespace std;, and we use string
directly in runtime libraries. However, we use ::std::string in generated
file; you need to modify the proto compiler to support different string
allocators. We do have custom allocator support in our TODO list internally,
but that probably won't happen in near future.
On Tue, Jul 12, 2011 at 5:45 AM, Jason Hsueh jas...@google.com wrote:
+Pherl
Hm, not sure how feasible this is. The code generator emits references to
::std::string. I suppose there might be some hack like adding a typedef of
::std::string to ::protobuf::string in one of the header stubs; then you
could override that (or perhaps use some kind of preprocessor macro, so that
it can be overridden via build flags, rather than modifying source)
#ifndef PROTOBUF_STRING_IMPLEMENTATION
#define PROTOBUF_STRING_IMPLEMENTATION ::std::string
#endif
Pherl's more familiar with the open source release - have any ideas?
(This does seem a little dangerous: if people are shipping around dynamic
libraries compiled with different string implementations, this would be
problematic. This is similar to the issues people have had with different
STL implementations in prod vs debug builds in MSVC. Not sure we want to
open up another can of worms.)
On Fri, Jul 8, 2011 at 7:26 PM, Gokulakannan Somasundaram
gokul...@gmail.com wrote:
Thanks a lot for the reply. I understood that part. Currently in the
.proto file, there is a string definition which gets translated to
std::string. What we actually need is a typedef which can be configured as
per the end user wish, before building the protobuf. But can i get some
assistance on how to implement the same.
Thanks,
Gokul.
On Sat, Jul 9, 2011 at 5:02 AM, Jason Hsueh jas...@google.com wrote:
We don't support this at this time - the primary problem is that
specifying an allocator for C++ string's produces a completely new type.
This means allocators can't simply be injected into a particularly message
instance; instead it would have to be part of the message definition.
On Wed, Jul 6, 2011 at 6:28 PM, Gokul gokul...@gmail.com wrote:
Hi,
In the application, i am working on, we are managing the memory of
strings using allocators. But i find that the protobuf uses strings
without any allocator support. Is there a plan to provide allocator
support for strings in future?
Or can someone guide me on how to go about implementing this change?
I would need a typedef somewhere to mention the string type and the
library should generate the appropriate code for it.
Thanks,
Gokul.
--
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.
--
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.