Are you, like Fedor, linking to the CRT statically (/MT)?  If so, does
linking dynamically (/MD) change anything?  I wonder if this leads to a
condition where CRT functionality is being used before it has been
initialized -- because initialization order between the CRT and libprotobuf
would not be defined when linking statically.  I don't know what CRT
features we use that would not work before dynamic init, though.  You'd
think the CRT would be carefully written so that everything works no matter
how early you call it.
On Mon, May 4, 2009 at 8:47 AM, Peter K. <koots...@gmail.com> wrote:

>
> Hi All,
>
> I have a project where we are using protocol buffers (C++ variant) in
> a DLL.  The project is written using Visual Studio 2008.
>
> At the end of the compilation process (which goes well), the DLL
> produced gets registered as part of a custom post-build step.
>
> Unfortunately, this causes regsvr32 to crash. with the (partial) call
> stack at the end of this message.
>
> This call stack looks similar to the one reported by Fedor here:
>
>
> http://groups.google.com/group/protobuf/browse_thread/thread/afbb8bff21a4a7c1/906da41aad4e8b31?lnk=gst&q=Fedor#906da41aad4e8b31
>
> Does anyone have any pointers as to why this might be happening?
>
> The issue appears to be that the protocol buffers library is trying to
> initialize some static member variables... but it's not clear to me
> why this would be happening during the DLL registration process.
>
> I've tried putting a breakpoint on the DllRegisterServer method, but
> the debugger never breaks there.  I don't understand why the C run-
> time startup code is being called just for DLL registration.
>
> Any and all comments aprpeciated!
>
> Regards,
>
> Peter K.
>
>
>
>        SP14Translator.dll!google::protobuf::DescriptorBuilder::BuildFile()
> + 0x5c bytes
>        SP14Translator.dll!
> google::protobuf::DescriptorPool::InternalBuildGeneratedFile()  +
> 0x285 bytes
>        SP14Translator.dll!sp14::protobuf_BuildDesc_sp14_2eproto()  Line 59
>     C
> ++
>        SP14Translator.dll!
>
> sp14::StaticDescriptorInitializer_sp14_2eproto::StaticDescriptorInitializer_sp14_2eproto
> ()  Line 65     C++
>        SP14Translator.dll!sp14::`dynamic initializer for
> 'static_descriptor_initializer_sp14_2eproto_''()  Line 66 + 0x13 bytes
> C++
>        msvcr90.dll!_initterm(void (void)* * pfbegin=0x10228000, void (void)
> * * pfend=0x102283c8)  Line 903 C
>        SP14Translator.dll!_CRT_INIT(void * hDllHandle=0x10000000, unsigned
> long dwReason=0, void * lpreserved=0x00000000)  Line 315 + 0xf bytes    C
> >       SP14Translator.dll!__DllMainCRTStartup(void *
> hDllHandle=0x10000000, unsigned long dwReason=0, void *
> lpreserved=0x00000000)  Line 537 + 0x8 bytes      C
>        SP14Translator.dll!_DllMainCRTStartup(void * hDllHandle=0x10000000,
> unsigned long dwReason=1, void * lpreserved=0x00000000)  Line 507 +
> 0xe bytes       C
>
> >
>

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