We never actually "chose" to use cdecl; it was simply the default used by
MSVC.  This whole idea that the programmer should have to choose between
calling conventions is a bit strange and inconvenient.  The
LIBPROTOBUF_EXPORT annotations are annoying enough; I hope we don't have to
litter our code with calling convention annotations as well.  Is there any
way we can modify the existing LIBPROTOBUF_EXPORT macro to specify calling
conventions too?

Your work-around of compiling the DLL with different settings should work
fine.  I can't imagine any reason why stdcall would cause problems.  Out of
curiosity, what is the binary size difference between the cdecl version and
the stdcall version?  The MSDN docs claim stdcall produces smaller binaries.

On Tue, Mar 15, 2011 at 5:05 AM, Kostya Y <kosty...@gmail.com> wrote:

> Hello
> It seems like the calling convention used in libprotobuf's vc project
> is cdecl while the Microsoft's preferred way (or the default one) is
> stdcall.
>
> Is there a reason why cdecl was chosen?
> I am getting linker errors as the functions are not strictly defined
> as cdelc so the linker assumes that it should use default project
> settings which in my case is stdcall. As a result I get the following
> errors:
> error LNK2001: unresolved external symbol "void __stdcall
> google::protobuf::internal::VerifyVersion(int,int,char const *)" (?
> VerifyVersion@internal@protobuf@google@@YGXHHPBD@Z)
>
> As you can see it expects it to be __stdcall (projects settings are
> set to default naming convention stdcall) while it is exported as
> cdecl.
>
> Any suggestions how to work around it?
> Thanks
> - Kostya
>
> --
> 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.

Reply via email to