MSVC9 is one of the platforms I test before releases, so it should work.
MSVC is finicky about STL, though.  You need to make sure that you compile
libprotobuf and your project with the the same settings, for all settings
that can affect the layout of STL objects.  Unfortunately, with MSVC, there
are several such settings.  Debug vs. release is the biggest one.  I'm not
entirely sure what else can be a problem; I've only heard anecdotal reports
that some flag mismatched caused strange crashes.

I'm not entirely sure if this is the reason for your problem, but it's the
only thing I can think of.

On Tue, Mar 31, 2009 at 3:10 PM, Justin Muncaster <
justin.muncas...@gmail.com> wrote:

>
> Hi,
>
> I've been trying to trace down a strange problem which I am having. I
> am creating a DLL and linking to protobufs statically, as the DLL uses
> protobufs internally. When the DLL is loaded, it crashes in
> CodedOutputStream::WriteRaw(), trying to memcpy new data directly into
> an output stream buffer.
>
> I believe the error occurs during the resizing of the output stream's
> buffer.
>
> Stepping into...
>  CodedOutputStream::WriteRaw()
>  StringOutputStream::Next()
>
> The member StringOutputStream::target_ gets resized (was: empty, now:
> 47 bytes allocated).
>
> Next is now supposed to return a pointer to the std::string's internal
> buffer. To do this it calls a function in stl_util.h called
> "string_as_array", which I believe is supposed to provide direct
> access to the interal buffer of a string. This is where I believe the
> error occurs, because the returned buffer is NULL.
>
> Accodring to the debugger, the string that was passed is a valid
> string capable of holding 47-bytes. str->empty() evaluates to false,
> and str->_Mysize == 47.
>
> The comments indicate that this function is doing some sort of
> workaround to get direct access to the string's internal buffer.
> Perhaps this workaround is broken on the MSVC 9.0 implementation of
> the stl?
>
> Oddly, I am unable to duplicate the error in a smaller test-jig. To
> throw a wrench in the works, when I attach a debugger to the release
> build appears to crash at a different place during the initialization,
> but I haven't figured out what is going on there.
>
> Is there something obvious which I may have missed? Any help is
> appreciated, thanks!
>
> Justin Muncaster
> Analyst
> Toyon Research Corporation
> >
>

--~--~---------~--~----~------------~-------~--~----~
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