Hello friends,

My company uses Protobuf as a shared library.  I know that Google 
recommends linking Protobuf statically, especially if it is used by a 
shared library, but that is not an option in my case, for reasons that are 
beyond my control.  As a result of dynamic linking, I am encountering 
Protobuf versions clash, when a third-party software uses a different 
version of Protobuf than my company does.

In order to isolate the third-party software from "our" version of 
Protobuf, I would like to wrap our version into an additional namespace.  I 
found out that in the Protobuf file google/protobuf/port_def.inc, there 
exists a preprocessor symbols PROTOBUF_NAMESPACE, PROTOBUF_NAMESPACE_ID, 
and PROTOBUF_NAMESPACE_OPEN, which I could re-define.  For instance, 

#define PROTOBUF_NAMESPACE_ID google::protobuf

can be replaced with

#define PROTOBUF_NAMESPACE_ID myNamespace::google::protobuf

I know that the above preprocessor symbol is _not_ consistently used 
through the Protobuf source files, but in principle it looks like it is not 
very hard to make the corresponding adjustments.

Has anybody tried that?  What were the difficulties you encountered?

Many thanks is advance!

-Yakov



-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/e174deee-c87e-4fd1-910c-2a22a707af58n%40googlegroups.com.

Reply via email to