There is a command-line option to add an export macro to all definitions.
 Use something like:

  protoc --cpp_out=dllexport_decl=MY_EXPORT_MACRO:outdir

However, be very careful when passing protobuf objects across a DLL
boundary.  The code on both sides must be dynamically linked against the
same version of the C runtime, otherwise you run into all kinds of binary
compatibility and heap issues.  See vsprojects/readme.txt for more
information.

On Fri, Nov 5, 2010 at 1:15 AM, yang yu <kojiyij...@gmail.com> wrote:

> I'm working on windows, some of my projects are dlls.
> i need to add __declspec dllexport/dllimport symbol with the function or
> variables to use the project as dll.
> but when i use protoc generate the source for the proto file,  of course
> they don't have the dllexport/dllimport symbol.
> the problem is after build dll A(have a proto), when i build B link the
> project A, i got some link error like this:
> error LNK2019:  unresolved external symbol "void
> PB:protobuf_AddDesc_Point2df_2eproto(void)""..................
>
> because the function "void PB:protobuf_AddDesc_Point2df_2eproto(void)" in
> dll A didn't export,
> so the project B link faild.
> anything help would be wonderful.
>
> -----------------------------------------------the situation like
> this-------------------------------------------
> in DLL-A, have a proto like this:
> ---------point.proto---------
> package PB;
>
> message Point2df
> {
> required float x = 1;
> required float y = 2;
> }
>
> in DLL-B, have a proto like this;
> ---------path.proto---------
> package PB;
> import "point.proto";
> message Path
> {
> repeated Point2df points = 1;
> }
>
>  --
> 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<protobuf%2bunsubscr...@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 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