Stack overflow error when loading CORE_DB_magick_.dll

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
WilliamRust

Stack overflow error when loading CORE_DB_magick_.dll

Post by WilliamRust »

Hi,

I compiled release 6.3.2-9 using VS 2005. The compilation was successful; however, when I register my COM object which is linked to CORE_DB_magick_.dll, regsvr32 fails with the following error message:

LoadLibrary("E:\p4\LEA\Main\Win\RAS\Bin\debug\ImageServer.dll") failed - Recursion too deep; the stack overflowed.

I was able to capture the call stack when the exception occurs (see below), but I can't for the life of me figure out what the problem is. If you have any ideas or debugging suggestions, please let me know.

Thanks!

CORE_DB_magick_.dll!_chkstk() Line 99 Asm
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01080760, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01080548, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01080338, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01080128, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01091f18, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01091d00, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01091ae0, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x010918b0, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01091688, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01091468, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01091248, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x010950d8, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01095218, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x01090f20, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x0108cc58, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x0108cad8, const unsigned long depth=0x00000004, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x0108c8e8, const unsigned long depth=0x00000003, _ExceptionInfo * exception=0x00072e88) Line 810 + 0x1c bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x0108c7e8, const unsigned long depth=0x00000002, _ExceptionInfo * exception=0x00072e88) Line 810 + 0x1c bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x010771f0, const unsigned long depth=0x00000002, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x00fa82a8, const unsigned long depth=0x00000002, _ExceptionInfo * exception=0x00072e88) Line 813 + 0x19 bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x00fa81a8, const unsigned long depth=0x00000001, _ExceptionInfo * exception=0x00072e88) Line 810 + 0x1c bytes C
CORE_DB_magick_.dll!TraverseLocaleMap(const char * filename=0x00071df8, _XMLTreeInfo * * nodes=0x0106f028, _XMLTreeInfo * node=0x0103bef8, const unsigned long depth=0x00000000, _ExceptionInfo * exception=0x00072e88) Line 810 + 0x1c bytes C
CORE_DB_magick_.dll!LoadLocaleList(const char * xml=0x01055200, const char * filename=0x00071df8, const char * locale=0x00fa3428, const unsigned long depth=0x00000001, _ExceptionInfo * exception=0x00072e88) Line 898 + 0x17 bytes C
CORE_DB_magick_.dll!LoadLocaleList(char * xml=0x01055200, const char * filename=0x01043028, const char * locale=0x00fa3428, const unsigned long depth=0x00000000, _ExceptionInfo * exception=0x00072e88) Line 884 + 0x22 bytes C
CORE_DB_magick_.dll!LoadLocaleLists(const char * filename=0x00bca7d8, const char * locale=0x00fa3428, _ExceptionInfo * exception=0x00072e88) Line 953 + 0x29 bytes C
CORE_DB_magick_.dll!InitializeLocaleList(_ExceptionInfo * exception=0x00072e88) Line 606 + 0x12 bytes C
CORE_DB_magick_.dll!GetLocaleInfo_(const char * tag=0x00072eb4, _ExceptionInfo * exception=0x00072e88) Line 191 + 0x9 bytes C
CORE_DB_magick_.dll!GetLocaleMessage(const char * tag=0x00073ed8) Line 435 + 0x13 bytes C
CORE_DB_magick_.dll!GetLocaleExceptionMessage(ExceptionType severity=ConfigureWarning, const char * tag=0x00bcca30) Line 561 + 0xc bytes C
CORE_DB_magick_.dll!ThrowMagickExceptionList(_ExceptionInfo * exception=0x0007a04c, const char * module=0x00bcc950, const char * function=0x00bccad8, const unsigned long line=0x00000335, ExceptionType severity=ConfigureWarning, const char * tag=0x00bcca30, const char * format=0x00bb1be0, char * operands=0x00075f68) Line 952 + 0xd bytes C
CORE_DB_magick_.dll!ThrowMagickException(_ExceptionInfo * exception=0x0007a04c, const char * module=0x00bcc950, const char * function=0x00bccad8, const unsigned long line=0x00000335, ExceptionType severity=ConfigureWarning, const char * tag=0x00bcca30, const char * format=0x00bb1be0, ...) Line 982 + 0x25 bytes C
CORE_DB_magick_.dll!GetMagickModulePath(const char * filename=0x00079010, MagickModuleType module_type=MagickCoderModule, char * path=0x00075ff8, _ExceptionInfo * exception=0x0007a04c) Line 821 + 0x64 bytes C
CORE_DB_magick_.dll!OpenModule(const char * module=0x0007b0b8, _ExceptionInfo * exception=0x0007a04c) Line 1075 + 0x19 bytes C
CORE_DB_magick_.dll!GetMagickInfo(const char * name=0x0007b0b8, _ExceptionInfo * exception=0x0007a04c) Line 506 + 0xd bytes C
CORE_DB_magick_.dll!IsMagickConflict(const char * magick=0x0007b0b8) Line 1120 + 0xd bytes C
CORE_DB_magick_.dll!GetPathComponent(const char * path=0x0007d0f8, PathType type=TailPath, char * component=0x0007c0f0) Line 927 + 0xc bytes C
CORE_DB_magick_.dll!InitializeMagick(const char * path=0x00fa5f88) Line 923 + 0x15 bytes C
CORE_DB_magick_.dll!DllMain(HINSTANCE__ * handle=0x00a50000, unsigned long reason=0x00000001, void * lpvReserved=0x00000000) Line 160 + 0x9 bytes C
CORE_DB_magick_.dll!__DllMainCRTStartup(void * hDllHandle=0x00a50000, unsigned long dwReason=0x00000001, void * lpreserved=0x00000000) Line 495 + 0x11 bytes C
CORE_DB_magick_.dll!_DllMainCRTStartup(void * hDllHandle=0x00a50000, unsigned long dwReason=0x00000001, void * lpreserved=0x00000000) Line 459 + 0x11 bytes C
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Stack overflow error when loading CORE_DB_magick_.dll

Post by magick »

Try the static build of ImageMagick and ImageMagickObject should work fine. We use the dynamic version and do not get the stack overflow you posted.
WilliamRust

Re: Stack overflow error when loading CORE_DB_magick_.dll

Post by WilliamRust »

Just to clarify, I'm not using the ImageMagickObject. I have my own in-proc COM object hosted in ImageServer.dll that utilizes ImageMagick++ classes. When I register ImageServer.dll, the stack overflow occurs.

Thanks for the suggestion about using the static libraries. I just built the multi-threaded static libraries for 6.3.2-9 and rebuilt my project, linking to CORE_RL_Magick++_.lib. Now I get a slew of unresolved external errors. Here's a sample:

Image2.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::read(class Magick::Blob const &)" (__imp_?read@Image@Magick@@QAEXABVBlob@2@@Z) referenced in function "private: int __thiscall CImage2::PutRawImageData(struct tagVARIANT)" (?PutRawImageData@CImage2@@AAEHUtagVARIANT@@@Z)
Image2.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Blob::~Blob(void)" (__imp_??1Blob@Magick@@UAE@XZ) referenced in function "private: int __thiscall CImage2::PutRawImageData(struct tagVARIANT)" (?PutRawImageData@CImage2@@AAEHUtagVARIANT@@@Z)
Image2.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Magick::Blob::Blob(void const *,unsigned int)" (__imp_??0Blob@Magick@@QAE@PBXI@Z) referenced in function "private: int __thiscall CImage2::PutRawImageData(struct tagVARIANT)" (?PutRawImageData@CImage2@@AAEHUtagVARIANT@@@Z)
Image2.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::syncPixels(void)" (__imp_?syncPixels@Image@Magick@@QAEXXZ) referenced in function "public: virtual long __stdcall CImage2::AddColor(int,int,int,long,long,long,long)" (?AddColor@CImage2@@UAGJHHHJJJJ@Z)
Image2.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: struct MagickLib::_PixelPacket * __thiscall Magick::Image::getPixels(int,int,unsigned int,unsigned int)" (__imp_?getPixels@Image@Magick@@QAEPAU_PixelPacket@MagickLib@@HHII@Z) referenced in function "public: virtual long __stdcall CImage2::AddColor(int,int,int,long,long,long,long)" (?AddColor@CImage2@@UAGJHHHJJJJ@Z)
Image2.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall Magick::Image::classType(enum MagickLib::ClassType)" (__imp_?classType@Image@Magick@@QAEXW4ClassType@MagickLib@@@Z) referenced in function "public: virtual long __stdcall CImage2::AddColor(int,int,int,long,long,long,long)" (?AddColor@CImage2@@UAGJHHHJJJJ@Z)

Sorry to bother, but can you tell me what I'm doing wrong here?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Stack overflow error when loading CORE_DB_magick_.dll

Post by magick »

This looks like the standard name mangling problem with C++. You need to have similar settings when you compile ImageMagick and your program so they produce similar symbols and can be found at link time.
Post Reply